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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mrothschild
Continued Contributor
Continued Contributor

Generic period over period

Is there a way to create a drill-down clustered column chart so that it can show "Year versus Last Year", "Quarter versus Last Quarter", or "Month versus Last Month", as I drill down?  Said differently, I only want two periods shown: Current and Last, and want them displayed as Year, Quarter, or Month depending on the drill-down choice.

 

Sample data posted below.

 

Thanks!

 

 

DateValuezzValue Last YearzzValue Last MonthzzValue Last Quarter
3/1/18$0   
4/1/18$0 $0 
5/1/18$0 $0 
6/1/18$0 $0$0
7/1/18$0 $0$0
8/1/18$17,692 $0$0
9/1/18$32,246 $17,692$0
10/1/18$24,740 $32,246$0
11/1/18$16,553 $24,740$17,692
12/1/18$16,543 $16,553$32,246
1/1/19$16,865 $16,543$24,740
2/1/19$441,567 $16,865$16,553
3/1/19$16,567$0$441,567$16,543
4/1/19$274,838$0$16,567$16,865
5/1/19$16,576$0$274,838$441,567
6/1/19$16,567$0$16,576$16,567
7/1/19$2,708,003$0$16,567$274,838
8/1/19 $17,692$2,708,003$16,576
9/1/19 $32,246 $16,567
10/1/19 $24,740 $2,708,003
11/1/19 $16,553  
12/1/19 $16,543  
1/1/20 $16,865  
2/1/20 $441,567  
3/1/20 $16,567  
4/1/20 $274,838  
5/1/20 $16,576  
6/1/20 $16,567  
7/1/20 $2,708,003  
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @mrothschild 
It is, just by checking the layer you are working with, along these lines:

Previous Period = 
IF ( ISINSCOPE ( 'Date'[Calendar Year Month] ), CALCULATE ( [Sales Amount], DATEADD('Date'[Date],-1,MONTH) ),
IF ( ISINSCOPE ( 'Date'[Calendar Year Quarter] ), CALCULATE ( [Sales Amount], DATEADD('Date'[Date],-1,QUARTER) ),
IF ( ISINSCOPE ( 'Date'[Calendar Year] ), CALCULATE ( [Sales Amount], DATEADD('Date'[Date],-1,year) ),0)))

PreviousPeriod.jpg 

 

If this solves your issues please mark it as the solution. Kudos 👍 are nice too.

View solution in original post

4 REPLIES 4
mrothschild
Continued Contributor
Continued Contributor

Thanks everyone!  The ISINSCOPE() did the trick!

 

Hi @mrothschild 

 

look at this.

https://www.daxpatterns.com/time-patterns/#complete-period-comparison-patterns

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


parry2k
Super User
Super User

@mrothschild you can surely do that, create a measure with ISINSCOPE function to find out which level you are at and then pick respectice measure.

 

Read more about ISINSCOPE here



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

jdbuchanan71
Super User
Super User

Hello @mrothschild 
It is, just by checking the layer you are working with, along these lines:

Previous Period = 
IF ( ISINSCOPE ( 'Date'[Calendar Year Month] ), CALCULATE ( [Sales Amount], DATEADD('Date'[Date],-1,MONTH) ),
IF ( ISINSCOPE ( 'Date'[Calendar Year Quarter] ), CALCULATE ( [Sales Amount], DATEADD('Date'[Date],-1,QUARTER) ),
IF ( ISINSCOPE ( 'Date'[Calendar Year] ), CALCULATE ( [Sales Amount], DATEADD('Date'[Date],-1,year) ),0)))

PreviousPeriod.jpg 

 

If this solves your issues please mark it as the solution. Kudos 👍 are nice too.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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