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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

This Year Last month and Last Year same Month

Hi All,

 

I need a help in showing the column headers in such a way that for example if I have data till Jan-2021 and I wanted to show the headers as Jan-2021 and Jan-2020.It should be changed on the data refresh.

 

Date
1-jan-2020

1-dec-2020

1-jan-2021
3-jan-2021

 

OutPut: 

 Jan-2021Jan-2020
Sales#####

 

Thanks in advance,

 

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Did you have a  date table in your model? You can create a date table and create many to one relationship to fact table.

 

Dim_Date = ADDCOLUMNS(CALENDAR(DATE(2020,1,1),DATE(2021,12,31)),"month",FORMAT([Date],"mmm")&"-"&YEAR([Date]))

Capture.PNG

Then use month column as columns in matrix:

Capture1.PNG

 

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

 

Best Regards,

Dedmon Dai

 

View solution in original post

4 REPLIES 4
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

Did you have a  date table in your model? You can create a date table and create many to one relationship to fact table.

 

Dim_Date = ADDCOLUMNS(CALENDAR(DATE(2020,1,1),DATE(2021,12,31)),"month",FORMAT([Date],"mmm")&"-"&YEAR([Date]))

Capture.PNG

Then use month column as columns in matrix:

Capture1.PNG

 

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

 

Best Regards,

Dedmon Dai

 

amitchandak
Super User
Super User

@Anonymous , one way is use time intelligence and this year vs last year same month, But that will not show month name

 

example with help from date table

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
Previous year Month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth(dateadd('Date'[Date],-11,MONTH)))

 

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi  @amitchandak

I have the calculations done. I required the headings.

@Anonymous , Assume you have a measure. Try a measure like( use calendar table marked as Date table)

 

measure =
calculate([meausre] ) + calculate([measure], dateadd('Date'[Date],-1,year))

 

In this case you should able to use month name as column in matrix

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.