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

Bar chart of measure x-axis does not respond to date slicer

Hi there,

I have two measures I am plotting in a bar chart (I use two so I can color them different colors, one for positive differences, one for negative differences). However, although the date slicer I am using works for charts of raw data (the data and x-axis is filtered), the bar chart of these measures filters the data, but not the x-axis of the chart. How do I get the chart to filter the x-axis based on the slicer too?

 

The two measures:

 

DayDiffNegative = if(DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]) < 0, DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]), 0)

 

DayDiffPositive = if(DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]) > 0, DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]), 0)

 

The chart, showing the problem, at the right hand end of the x-axis:

Capture.PNG

 

Any help would be appreciated,

Regards,

Will

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I managed to solve it. Just needed to use BLANK() instead of zeroes in the IF statement...

 

DayDiffNegative = if(DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]) < 0, DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]), BLANK())

 

DayDiffPositive = if(DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]) > 0, DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]), BLANK())

View solution in original post

2 REPLIES 2
21818
Frequent Visitor

Hi, 

 

I am having the same issue and your solution was not working for me. As you can see from picture below, when I change the date slicer those values not included in the selected date period appear as zero (highlited values). I would like that the x-axis was changed according to the date slicer in order to show only the desired time period. 

Capture.JPG

The measure I am using is the following:

Measure =CALCULATE( DIVIDE(SUM(A),SUM(B),BLANK()))

 

Thanks in advance for any help! 

Anonymous
Not applicable

I managed to solve it. Just needed to use BLANK() instead of zeroes in the IF statement...

 

DayDiffNegative = if(DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]) < 0, DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]), BLANK())

 

DayDiffPositive = if(DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]) > 0, DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[gin]), BLANK())

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.

Top Solution Authors