Forum Discussion
Anonymous
2 years agoNot applicable
Time Intelligence: Measure within a Measure within a Measure
Hi,
I have the below measure:
Count of Apples = DISTINCTCOUNT('TableA'[Apple_SK])
I now want to use this measure within a second measure:
Count of Apples Exited =
CALCULATE(
[Count of Apples],
NOT ISBLANK(TableB[Apple Exit Date])
)
TableA -> TableB on Apple_SK
I now want to use the second measure in a third measure:
Count of Apples Rolling 1 Qtr =
VAR __lastDate = LASTDATE( TableB[Apple Exit Date] )
VAR __result =
CALCULATE(
[Count of Apples Exited],
DATESINPERIOD( TableB[Apple Exit Date], __lastDate, -1, QUARTER )
)
RETURN
__result
I only get the correct result from my third measure if I use the first measure and not the second measure within it...
Count of Apples Rolling 1 Qtr =
VAR __lastDate = LASTDATE( TableB[Apple Exit Date] )
VAR __result =
CALCULATE(
[Count of Apples],
DATESINPERIOD( TableB[Apple Exit Date], __lastDate, -1, QUARTER )
)
RETURN
__result
Why can I not use [Count of Apples Exited] to calculate the rolling latest quarter result? The [Count of Apples Exited] result is returned, as if the DATESINPERIOD filter is not being applied?
Thanks.
1 Reply
- Greg_DecklerCommunity Champion
Anonymous You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008