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
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors