Forum Discussion
Tabular Editor: Non-Standard Calendar time comparisons/Conditional calculation with filters
Try this:
VAR CurrWMWK =
SELECTEDVALUE( 'Calendar'[WM Chronological Order])
RETURN
IF(
ISSELECTEDMEASURE([OH Qty], [OH Cost], [POS Qty]),
CALCULATE(
DIVIDE( SELECTEDMEASURE(), COUNTROWS('Calendar')), --or the calendar table you need
FILTER(
ALL('Calendar'),
'Calendar'[WM Chronological Order] <= CurrWMWK - 1
&& 'Calendar'[WM Chronological Order] > CurrWMWK - 14
)
)
)
It accepted the DAX, but the output doesn't seem to be reacting to the if statement and the values are not as expected
- julioverdugo3 years agoFrequent Visitor
You may need to adjust the filters for your period definition.
Can you provide a screenshot of your calendar table to understand the mechanic behind it and explain in more detail what is the expected output from the calculation?
- Dichilyn13 years agoFrequent Visitor
It is not an issue with the calendar or time portion, as the formula stemmed from a summation of the L13wks (which I validated before adding to the dax to apply the conditional filter).
- julioverdugo3 years agoFrequent Visitor
I recommend you troubleshoot it piece by piece. You can create two additional calculations to pull only the Selected measure and another one for COUNTROWS just to validate what they are returning.
Are all your measures additive or do you have more complex definitions on your measures?