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
aaronvincentnz
Helper III
Helper III

Line and Stacked Column chart - hide specific data points

Hi

 

Is there a way within a line and stacked column chart to hide some of the data (in this case, the bars) so I'm only showing the oldest and the latest data points

 

Here's what I have

aaronvincentnz_0-1663677428743.png

Here's what I'd like to achieve

 

aaronvincentnz_1-1663677467078.png

Any help would be appreciated.

 

Thanks

 

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

Hi, @aaronvincentnz ;

Such as  Pragati11  said, however One thing is different, what I'm establishing here is the values of the earliest and latest dates.

 

Measure = 
var _max=CALCULATE(MAX('financials'[Date]),ALL(financials))
var _min=CALCULATE(min('financials'[Date]),ALL(financials))
return CALCULATE(SUM(financials[ Sales]),FILTER('financials',[Date] in {_max,_min}))

 

Then change the data label.(close line's label and retain column's)

vyalanwumsft_0-1663729089504.pngvyalanwumsft_1-1663729098084.png

The final show:

vyalanwumsft_0-1663738878976.png


Best Regards,
Community Support Team _ Yalan Wu
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

5 REPLIES 5
aaronvincentnz
Helper III
Helper III

managed to get it to work. thanks all

v-yalanwu-msft
Community Support
Community Support

Hi, @aaronvincentnz ;

Try it.

 

Measure = 
var _max=EOMONTH( CALCULATE(MAX('financials'[Date]),ALLSELECTED(financials)),0)
var _min=EOMONTH(_max,-13)
return CALCULATE(SUM(financials[ Sales]),FILTER('financials', EOMONTH([Date],0) in {_max,_min}))

 

 The final show:

vyalanwumsft_0-1664351487413.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @aaronvincentnz ;

Such as  Pragati11  said, however One thing is different, what I'm establishing here is the values of the earliest and latest dates.

 

Measure = 
var _max=CALCULATE(MAX('financials'[Date]),ALL(financials))
var _min=CALCULATE(min('financials'[Date]),ALL(financials))
return CALCULATE(SUM(financials[ Sales]),FILTER('financials',[Date] in {_max,_min}))

 

Then change the data label.(close line's label and retain column's)

vyalanwumsft_0-1663729089504.pngvyalanwumsft_1-1663729098084.png

The final show:

vyalanwumsft_0-1663738878976.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the above. It partially worked....

  • for some reason, the line is not displaying (i've checked the various axis to make sure what's meant to be 'on' is on)
  • I'm wanting to chart a set date range, basically the last 13 months (e.g. aug 21 to aug 22), but when I change this, the 'min' data point disappears (I guess because the formula is taking the oldest date in the entire file as opposed to the oldest date that I want to chart)
  • For some reason, I don't have the FX option within the column sections when it comes to change the columns to 'white' (to hide them)
Pragati11
Super User
Super User

HI @aaronvincentnz ,

 

This can be achieved by a little hack in Power BI. There can be multiple ways of achieving this, but this is what I found out as a solution to this problem.

Consider the following example chart:

Pragati11_0-1663678014039.png

Now in this chart, I want to display bars for only MIN and MAX sales value but the line should be there for everything.

I created a following DAX measures.

Max sales & Min sales measures for sales. I want my sales to change with YEAR column therefore an ALLEXCEPT is used. You can ignore it in your case.

# Max Sales = MAXX(ALLEXCEPT(Sales, Sales[Year]), [# Total Sales])
# Min Sales = MINX(ALLEXCEPT(Sales, Sales[Year]), [# Total Sales])

 

# Sales Dynamic display Max Min Bars = 
IF(
    [# Total Sales] = [# Max Sales] || [# Total Sales] = [# Min Sales] , "#118DFF", // show BLUE color for the bars
    "#FFFFFF" // show WHITE color for bars (this should be your visual background color)
) 

Now I go to my visual formatting settings and use this measure for formatting on bars:

Pragati11_2-1663678400804.png

After hitting ok I get the desired result:

Pragati11_3-1663678496453.png

Now the chart shows lines for all the points, but the bars for only min and max values.

 

The trick here is to give your other bars on the chart same color as your visual background by using the measure calculation.

Let me know if this solution helps.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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