cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
simrantuli
Continued Contributor
Continued Contributor

YTD Trend and 'Show items with no data' issue

Hi All,

 

I am facing an issue while showing YTD trend in a bar chart.

So, my bar chart looks something like below, if no value from the 'Month' slicer is selected. I have checked 'Show items with no data' as I want to show Months with zero values as well.

simrantuli_0-1597339022302.png

Now, the issue comes when I select a month from the slicer. Let's say I select 'May 20', then the bar chart shows me data till May 20 but also shows June 20 with value zero as shown below.

simrantuli_1-1597339116127.png

Basically what I want is that if I have selected a Month, then the chart should show me data till that month only. In the above chart, I should not see 'June 20'.

How do I resolve this?

 

Thanks!

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

Hi, @simrantuli 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

c1.png

 

Calendar(a calculated table):

Calendar = CALENDARAUTO()

 

There are no relationship between two tables. You may create calculated columns and measure as below.

Calculated column:

Table Year Month = YEAR('Table'[Date])*100+MONTH('Table'[Date])
Calendar Year Month = YEAR('Calendar'[Date])*100+MONTH('Calendar'[Date])

 

Measure:

Visual Control = 
IF(
    SELECTEDVALUE('Table'[Table Year Month])<=SELECTEDVALUE('Calendar'[Calendar Year Month]),
    1,0
)

 

Finally you need to put the measure in the visual level filter and use 'Date' column from 'Calendar' to get the result.

c2.png

 

Best Regards

Allan

 

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
v-alq-msft
Community Support
Community Support

Hi, @simrantuli 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

c1.png

 

Calendar(a calculated table):

Calendar = CALENDARAUTO()

 

There are no relationship between two tables. You may create calculated columns and measure as below.

Calculated column:

Table Year Month = YEAR('Table'[Date])*100+MONTH('Table'[Date])
Calendar Year Month = YEAR('Calendar'[Date])*100+MONTH('Calendar'[Date])

 

Measure:

Visual Control = 
IF(
    SELECTEDVALUE('Table'[Table Year Month])<=SELECTEDVALUE('Calendar'[Calendar Year Month]),
    1,0
)

 

Finally you need to put the measure in the visual level filter and use 'Date' column from 'Calendar' to get the result.

c2.png

 

Best Regards

Allan

 

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

simrantuli
Continued Contributor
Continued Contributor

@v-alq-msft Thank you so much! It worked. I was trying to figure out a solution since days. Thanks again.

amitchandak
Super User IV
Super User IV

@simrantuli , once you select a month. it will show YTD for that monthly only, Refer if this approach can help

https://www.youtube.com/watch?v=duMSovyosXE



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors