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
2366
Helper I
Helper I

Current Periods Top 5 compare with last period

Hi All,

 

I was wondering if/how we can calculate top 3 customers based on sales for the selected period (slicer) and show what their previous months sales was in the same visual?

 

Thank you

3 REPLIES 3
amitchandak
Super User
Super User

@2366 , Assume you two measure current period and last period

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

then have top N measure like

 

CALCULATE( [MTD Sales] ,TOPN(3,allselected('Customer'[Customer]),[MTD Sales],DESC),values('Customer'[Customer]))

 

 

Last month based on current month top N
CALCULATE( [last MTD Sales] ,TOPN(3,allselected('Customer'[Customer]), [MTD Sales] ,DESC),values('Customer'[Customer]))

 

 

For TOPN- https://youtu.be/QIVEFp-QiOk

Thanks a lot!

I have got it to work for MTD and Last Month MTD in a calculation group. 
Is there a way we can put the TopN part in a conditional switch statement/ variable to handle different measures / table? 
Thanks

Hi @2366 

I just want to confirm if you resolved this issue? If yes, you can accept the answer helpful as the solution or share you method and accept it as solution, thanks for your contribution to improve Power BI.

If you need more help, please let me know.

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

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.

Top Solution Authors