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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Imre
Regular Visitor

Dynamic comparison of customer status by date

Hi,

 

I'd like to create a report where I am able to categorize records and compare them between two dates or periods where dates are selected by the user. The comparison coult be any two distinct dates or any two periods where periods have the same length. Eg. This week vs last week, last quarter vs the same quarter last year, etc. 

 

Here is an example:

 

Data table:

Imre_0-1621590524652.png

 

 

Matrix (just to be easier to see, not needed in the report)

Imre_2-1621590567807.png

 

Result: (table form and/or visualization)

Imre_1-1621590551800.png

 

So I need to be able to compare number of transactions client by client based on user's date or date period input. 

 

Is it possible to do this in Power BI?

 

Thanks. 

 

1 REPLY 1
amitchandak
Super User
Super User

@Imre , For Qtr and year you can use time intelligence for this period vs last period

 

For week you need additional column in date tbale

 

Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format


Then create measures  like
This Week = CALCULATE(sum('Table'[Transactions]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Transactions]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
diff = [This Week] -[Last Week]

Same as last week =countx(filter(values('Table'[customer]),[diff] =0 ),[Customer])
GT as last week =countx(filter(values('Table'[customer]),[diff] >0 ),[Customer])
LT as last week =countx(filter(values('Table'[customer]),[diff] <0 ),[Customer])

 

 

Same way create other measure for Qtr and year


then create a new table like

Table =
union(
summarize('Table','Date'[Week], "Measure","same","Count",[Same as last week] , "Less" ,[GT as last week] ,"More",[LT as last week ] )
summarize('Table','Date'[Week], "Measure","same","Count",[Same as last Year] , "Less" ,[GT as last Year] ,"More",[LT as last Year ] )
)

 

use this table for display

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors