Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not 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 1
Greg_Deckler
Community Champion
Community 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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.