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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
prakash11440278
Post Prodigy
Post Prodigy

Year selection by current year and previous year in matrix chart

HI Team,

Can you please provide the dax expressions for the current year & previous year measures by year filter.

Below is the screen shot with requirement.

 

prakash11440278_0-1618245549325.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @prakash11440278 ,

Please correct me if I wrongly understood your question.

You can follow the steps below to achieve your needs.

(1)Create a Year table, and use the table as a slicer.(In visual filter, you can hide 2019)

Year = VALUES(Sales[Date])

 

(2)Create a measure to return the values between selected year and selected year-1.

Measure = CALCULATE(SUM(Sales[Sales]),FILTER(Sales,MAX(Sales[Date])>=MAX('Year'[Year])-1 && MAX(Sales[Date])<=MAX('Year'[Year])))

 

(3)Add a matrix visual ,use Sales[Category] as rows, Sales[Date] as columns, Sales[Measure] as values. You will get the data you want .

 

The effect is as shown:

Ailsa-msft_0-1618391563451.png

Best Regards

Community Support Team _ Ailsa Tao

 

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @prakash11440278 ,

Please correct me if I wrongly understood your question.

You can follow the steps below to achieve your needs.

(1)Create a Year table, and use the table as a slicer.(In visual filter, you can hide 2019)

Year = VALUES(Sales[Date])

 

(2)Create a measure to return the values between selected year and selected year-1.

Measure = CALCULATE(SUM(Sales[Sales]),FILTER(Sales,MAX(Sales[Date])>=MAX('Year'[Year])-1 && MAX(Sales[Date])<=MAX('Year'[Year])))

 

(3)Add a matrix visual ,use Sales[Category] as rows, Sales[Date] as columns, Sales[Measure] as values. You will get the data you want .

 

The effect is as shown:

Ailsa-msft_0-1618391563451.png

Best Regards

Community Support Team _ Ailsa Tao

 

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

amitchandak
Super User
Super User

@prakash11440278 , with help from year/date table joined

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

But if you need to display them as the year in the matrix, use an independent date table

refer this video: https://youtu.be/44fGGmg9fHI

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

This expressions not working for my scenario and also i am seeing grand total mismatch.

Helpful resources

Announcements
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.