Forum Discussion

BIanon's avatar
BIanon
Icon for Helper V rankHelper V
3 years ago

VALUES() as CALCULATE() filter

Hello Community,

I understand that VALUES() returns a distinct one column table.

I also understand that using VALUES() with one filter context and then using that as a filter for a calculation with another filter context will run the calculation only taking the distinct values generated from the first context into account. Hope I'm not far off.

But, I've come across this behaviour which I don't really understand and am hoping someone can explain.

If I do a simple SalesAmt = SUM('FactTable'[SalesAmt]) I obviously just get a simple sum, but if I the do this:
CALCULATE( [SalesAmt], VALUES('FactTable'[CustomerID])) then I get a very different result which I cannot explain to myself

What am I filtering away and why?

3 Replies

  • ppm1's avatar
    ppm1
    Icon for Solution Sage rankSolution Sage

    That is odd. Please share more info about both your model (tables and relationships) and the visual (which fields and measures used in it).

     

    Pat

    • BIanon's avatar
      BIanon
      Icon for Helper V rankHelper V

      I made a mistake - the measure I am using is not a simple sum but a SUMX()

      SUMX( 'FactTable', 'FactTable'[SalesAmt]) * 'FactTable'[Factor] )

      I would still like an explanation but I apologize for the confusion

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi BIanon ,

         

        Here I create a sample and I couldn't reproduce your issue. Please share a sample file with me and show me a screenshot with the result you want. This will make it easier for me to find the solution.

         

        Best Regards,
        Rico Zhou

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.