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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Displaying Dates

Hi All,

 

I have created a calendar table to work alongside my data table. I want to create a graph that totals the values to a specified year and then show monthly totals.

 

This is what i am trying to acheive

 

hetal247_0-1675956994859.png

 

At present, i have dates that range from 2015 to present. I want to display the total prior to 2022 and the monthly thereafter are shown above. Is this possible anf if so how can i acheive this.

2 ACCEPTED SOLUTIONS
jdbuchanan71
Super User
Super User

It is possible, yes.  You would need to add 2 calculated columns to your Calendar table.  1 for the display value and 1 to sort the display value into the correct order.

First the display value:

Month Year Prior = 
IF ( YEAR ( [Date] ) < YEAR ( TODAY() ) - 1, "Prior to " & YEAR ( TODAY() ) - 1, FORMAT ( [Date], "mmm-yy") )

 Then the sort order:

Month Year Prior Sort = 
IF ( YEAR ( [Date] ) < YEAR ( TODAY() ) - 1, 1, YEAR([Date]) * 100 + MONTH ( [Date] ) )

Make sure to select the [Month Year Prior] column and set the sort by to [Month Year Prior Sort]:

jdbuchanan71_0-1675958581099.png

Then add the [Month Year Prior] to your chart.

The column is dynamic, so in 2024 it will show 'Prior to 2023' and grab all those dates.

 

View solution in original post

serpiva64
Super User
Super User

Hi,

you can obtain this

serpiva64_0-1675958563562.png

by adding  a calculated column

YM = 'Date'[Year]&FORMAT('Date'[Month Number],"00")
and then creating a group
serpiva64_1-1675958895304.png

If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

 

 

View solution in original post

4 REPLIES 4
serpiva64
Super User
Super User

Hi,

you can obtain this

serpiva64_0-1675958563562.png

by adding  a calculated column

YM = 'Date'[Year]&FORMAT('Date'[Month Number],"00")
and then creating a group
serpiva64_1-1675958895304.png

If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

 

 

Anonymous
Not applicable

thank you @serpiva64 .

It works however would prefer to show Month name and year instead of Year and month number but it works exactly how i wanted it to

jdbuchanan71
Super User
Super User

It is possible, yes.  You would need to add 2 calculated columns to your Calendar table.  1 for the display value and 1 to sort the display value into the correct order.

First the display value:

Month Year Prior = 
IF ( YEAR ( [Date] ) < YEAR ( TODAY() ) - 1, "Prior to " & YEAR ( TODAY() ) - 1, FORMAT ( [Date], "mmm-yy") )

 Then the sort order:

Month Year Prior Sort = 
IF ( YEAR ( [Date] ) < YEAR ( TODAY() ) - 1, 1, YEAR([Date]) * 100 + MONTH ( [Date] ) )

Make sure to select the [Month Year Prior] column and set the sort by to [Month Year Prior Sort]:

jdbuchanan71_0-1675958581099.png

Then add the [Month Year Prior] to your chart.

The column is dynamic, so in 2024 it will show 'Prior to 2023' and grab all those dates.

 

Anonymous
Not applicable

Thanks @jdbuchanan71  this is exactly what i wanted and works.

 

very much appreciated

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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