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
dominik_thoe
Frequent Visitor

PYTD, YTD and monthly values in one bar chart

Hello,

I have a table with dates and values. I want to show the values in a bar chart in the following way: All values of prevoius year should be aggregated to PYTD, all of the current year to YTD and months of current year should be displayed as single value. 2021-02-02_19h24_08.png

 

thanks for your help!

 

Dominik

1 ACCEPTED SOLUTION

Hi @v-janeyg-msft@Gabriel_Walkman  .

thanks for your support and input.

However I want to see 2020, Jan to Apr and 2021 in one chart without using the drill down function.

 

As a workouraround I duplicate the current year data, create a new column with PY/YTD/Month (based on date) in both tables and and join them.

 

dominik_thoe_0-1612856640662.png

 

Dominik

View solution in original post

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @dominik_thoe 

 

According to your description, I think you can directly use 'year and month' in the date hierarchy, then use the drill down function, you can easily get the results you want.

Like this:

32.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

Hi @v-janeyg-msft@Gabriel_Walkman  .

thanks for your support and input.

However I want to see 2020, Jan to Apr and 2021 in one chart without using the drill down function.

 

As a workouraround I duplicate the current year data, create a new column with PY/YTD/Month (based on date) in both tables and and join them.

 

dominik_thoe_0-1612856640662.png

 

Dominik

Gabriel_Walkman
Continued Contributor
Continued Contributor

Hi!

 

To me, this sounds like bad practice. I'd make separate tables, one for PYTD and YTD and one for current year months.

For the Year graph, you can make a calculated column

PYTD or YTD =
var _y = year( [Date] )
var _ty = year( today() )
return
if( _y = _ty-1,
    "PYTD",
    if( _y = _ty,
        "YTD"
    )
)



For the Month graph I'd make a separate calendar table with month names, make a relationship between dates, and use the calendar[Monthname] as x-axis.

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.