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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
andybamber
Helper III
Helper III

Time Intelligence

Hi Group,

 

A question on the Time Intelligence functions... I have a matrix visual, and one of the measures is a month on month change... That I can do, and it works, however the requirement is that the same sort of calculation also works at other levels of the date hierarchy, so for instance if the user wants to view just at the year level, the result they see is the year on year change... at the moment because I have a measure which uses PREVIOUSMONTH, when the user views at the Year level the measure is still trying to show a month on month change... 

 

The question is, how can make this visual work so that the change shows, and is based on the level the user is currently viewing at?

 

Cheers,

Andy

 

 

1 ACCEPTED SOLUTION

@andybamber 

You need to create additional measures fo different granilarity and then create measure with SWITCH function:

GAP_Chg =
SWITCH (
    TRUE (),
    ISINSCOPE ( DATE_DIMENSION[Month] ), [GAP_Mom_Chg],
    ISINSCOPE ( DATE_DIMENSION[Quarter] ), [GAP_QoQ_Chg],
    ISINSCOPE ( DATE_DIMENSION[Year] ), [GAP_YoY_Chg]
)

By using this measure in the matrix/chart you can easily change MoM to YoY etc.



_______________
If I helped, please accept the solution and give kudos! 😀

View solution in original post

5 REPLIES 5
AntrikshSharma
Super User
Super User

@andybamber  You can use something like this:

1.PNG

amitchandak
Super User
Super User

@andybamber , I have part of it created in this blog

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

Last Period Employee = 
var _min_date = minx(all('Date'),'Date'[Date])
var _Expression=if(ISFILTERED('Date'[Month Year]),maxx('Date',DATEADD('Date'[Date],-1,MONTH)),maxx('Date',DATEADD('Date'[Date],-1,YEAR)))
Return
 CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=_Expression && Employee[Start Date]>=_min_date && (ISBLANK(Employee[End Date]) || Employee[End Date]>_Expression)),(Employee[Employee Id ])),CROSSFILTER(Employee[Start Date],'Date'[Date],None))

 

check the usage of isfiltered. The same way you can use isinscope

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

 

also refer

https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...
https://www.youtube.com/watch?v=vlnx7QUVYME

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
lkalawski
Resident Rockstar
Resident Rockstar

Hi @andybamber
You can use INSCOPE function to easily change the measure based on the level on which user is.
Please check this article: https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

 

If you can then please share your measure and I will help you.



_______________
If I helped, please accept the solution and give kudos! 😀

 

 

Hello There!

 

this is what i'm using...

 

GAP_Mom_Chg = CALCULATE([Gap_Rec_Need]) - CALCULATE([Gap_Rec_Need],PREVIOUSMONTH(DATE_DIMENSION[Date Key]))

 

Cheers

 

Andy

@andybamber 

You need to create additional measures fo different granilarity and then create measure with SWITCH function:

GAP_Chg =
SWITCH (
    TRUE (),
    ISINSCOPE ( DATE_DIMENSION[Month] ), [GAP_Mom_Chg],
    ISINSCOPE ( DATE_DIMENSION[Quarter] ), [GAP_QoQ_Chg],
    ISINSCOPE ( DATE_DIMENSION[Year] ), [GAP_YoY_Chg]
)

By using this measure in the matrix/chart you can easily change MoM to YoY etc.



_______________
If I helped, please accept the solution and give kudos! 😀

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.