Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.