locked
TREATAS not working with SUM RRS feed

  • Question

  • Hi Community

    I am trying to build a virtual relationship using TREATAS/INTERSECT but did not work with SUM nor VALUES. I know SUM is for amount and I thought VALUES is for string but did not work as well. Can someone lend me a help?

    CustomerName = CALCULATE(
    VALUES(FactInternetSales[CustomerName]),
    TREATAS(VALUES(DimCustomer[CustomerKey]),FactInternetSales[CustomerKey]))

    https://1drv.ms/u/s!AjxzXMIO4yRIhSyLtp_PdyRqw4wu?e=u9cItr

    Sunday, October 4, 2020 6:19 AM

Answers

  • Hi Marc. This forum is for Power Query questions. Please post DAX questions in the Power BI Community or Microsoft Q&A: https://docs.microsoft.com/en-us/answers/products/.

    Ehren

    Friday, October 9, 2020 9:09 PM

All replies

  • I’m not sure what you are trying to do, but this formula doesn’t really make any sense. If you had a filter on a customer dimension column, and if you had no relationship between the dimension and factinternetsales, and you were trying to calculate customer sales, then this should work

    CustomerName = CALCULATE(
    SUM(FactInternetSales[extendedamount]),
    TREATAS(VALUES(DimCustomer[CustomerKey]),FactInternetSales[CustomerKey]))

    read my article here https://exceleratorbi.com.au/virtual-filters-using-treatas/


    Self Service BI Expert using Power Pivot http://exceleratorbi.com.au

    Monday, October 5, 2020 4:03 AM
  • Not calculate any anount, my two tables are all string values, I dont know how to get the string values with virtual relationship. Can you help?
    Monday, October 5, 2020 2:51 PM
  • There is no reason why treatas will not work with string values. The formula I posted will work. If it doesn’t, there is something else wrong with your model. It is impossible to saw what unless you post a sample of the model

    Self Service BI Expert using Power Pivot http://exceleratorbi.com.au

    Monday, October 5, 2020 6:56 PM
  • Hi Marc. This forum is for Power Query questions. Please post DAX questions in the Power BI Community or Microsoft Q&A: https://docs.microsoft.com/en-us/answers/products/.

    Ehren

    Friday, October 9, 2020 9:09 PM