Forum Discussion
dsandip
3 years agoFrequent Visitor
CALCULATE function is not working
Hi, I using below DAX: Cureent Quarter Sales = CALCULATE([Sales Amount], FILTER(ALL('Calendar'), 'Calendar'[Current QTD] = 1) ) and want to calculate values for [Current QTD] = 1 only and f...
- 3 years ago
dsandip OK, it's incorrect but what is your definition of correct? Maybe this?
Current Quarter Sales = VAR __Current = MAX( 'Calendar'[Current QTD] ) VAR __Result = IF( __Current = 1, CALCULATE([Sales Amount], FILTER(ALL('Calendar'), 'Calendar'[Current QTD] = 1)), 0 ) RETURN __Result
Greg_Deckler
3 years agoCommunity Champion
dsandip OK, it's incorrect but what is your definition of correct? Maybe this?
Current Quarter Sales =
VAR __Current = MAX( 'Calendar'[Current QTD] )
VAR __Result = IF( __Current = 1, CALCULATE([Sales Amount], FILTER(ALL('Calendar'), 'Calendar'[Current QTD] = 1)), 0 )
RETURN
__Resultdsandip
3 years agoFrequent Visitor
Yes, it is working now. But I wonder that why it is not working for below DAX:
Measure 5= CALCULATE([Sales Amount], FILTER(ALL('Calendar'), 'Calendar'[Current QTD] = 1))
like below:
So, we need to use a if() with condition to show values for current quarter only and others to show 0. right?