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
Anonymous
Not applicable

Display Month-wise and YTD data in one visual

Hi Guys,

 

I am trying to display month-wise and  YTD data in one visual, which I am not able to do it now. Is there any provision to do this in Power BI?

I have attached a sample snapshot with this, that I want to achieve in power BI. Please suggest any visual if any or DAX.

Sample graphSample graph

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

Hi @Anonymous ,

 

Please check the following steps as below.

 

1. Create a calculated table and relat it to the fact table like this.

YM = UNION(VALUES('Table'[Year]),VALUES('Table'[Month]))

Capture.PNG

 

2. Then we can create a measure to get the excepted result as we need.

 

Measure = var a = SUM('Table'[value])
return
IF(ISBLANK(a),CALCULATE(SUM('Table'[value]),USERELATIONSHIP('Table'[Year],YM[Year])),a)

2.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

8 REPLIES 8
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please check the following steps as below.

 

1. Create a calculated table and relat it to the fact table like this.

YM = UNION(VALUES('Table'[Year]),VALUES('Table'[Month]))

Capture.PNG

 

2. Then we can create a measure to get the excepted result as we need.

 

Measure = var a = SUM('Table'[value])
return
IF(ISBLANK(a),CALCULATE(SUM('Table'[value]),USERELATIONSHIP('Table'[Year],YM[Year])),a)

2.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

 

This solution works excellent, How i can sort the months chronologically? Jan, Feb, Mar, Apr, .........YTD

 

tks.

 

Anonymous
Not applicable

Thank you for the solution. It worked for me.

Minseven
Helper I
Helper I

I don't get your question.

 

Put the "YEAR" in the Legend dimension

RobbeVL
Impactful Individual
Impactful Individual

Hi,

 

You'll be able to use this DAX measure:
SAMEPERIODLASTYEAR()
https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax 

just do ex.
CALCULATE(SUM(SALES); SAMEPERIODLASTYEAR(DATE))

 

And you should have a measure with the data from last year.

 

Robbe

Anonymous
Not applicable

Thanks

We have already used that DAX, but it is not working.

What I want is one bar for past year and for this year(i.e 2019), the graph should show month-wise, this both(past year and 2019 month-wise) in one graph as shown in the screenshot.

 

Anonymous
Not applicable

 

I am able to do it in excel, need solution to implement same in Power BIsample.jpg

RobbeVL
Impactful Individual
Impactful Individual

Hi,

DataViz wise, you really created a monster here.

Any specific reason why you would do it like this?

 

For doing this you should create a custom table that would precalculate all values you need. 

robbe

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.