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
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.

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

amitchandak
Super User
Super User

@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

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.