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

Hide Line Values if multiple selections in slicer are different

Hi all,

Hoping someone can help me. I have a basic Line and stacked column chart created and im trying to add in Target lines for each country. Each country has a different target so I need a way to only show the target line if the countries chosen have the same target. 

If multiples countries/selections are chosen from the slicer and they have different targets I dont want the line value to appear at all. Or even for it to change to 0 or something. Any ideas?!

 

Capture.PNG

 

1 ACCEPTED SOLUTION
lc_finance
Solution Sage
Solution Sage

Hi @Anonymous ,

 

 

that should be possible using a measure to check what is selected by the user, and showing a result accordingly.

You can use the DAX formula SELECTEDVALUE to accomplish it:

https://docs.microsoft.com/en-us/dax/selectedvalue-function

 

Does this help?

 

If not, can you share a sample Power BI file? You can share it using One Drive, Google Drive or another similar tool.

 

Regards,

 

LC

Interested in Power BI and DAX tutorials? Check out my blog at www.finance-bi.com

View solution in original post

8 REPLIES 8
Icey
Community Support
Community Support

Hi @Anonymous ,

If you don't mind, please give me an example PBIX file.

 

Best Regards,

Icey

 

lc_finance
Solution Sage
Solution Sage

Hi @Anonymous ,

 

 

that should be possible using a measure to check what is selected by the user, and showing a result accordingly.

You can use the DAX formula SELECTEDVALUE to accomplish it:

https://docs.microsoft.com/en-us/dax/selectedvalue-function

 

Does this help?

 

If not, can you share a sample Power BI file? You can share it using One Drive, Google Drive or another similar tool.

 

Regards,

 

LC

Interested in Power BI and DAX tutorials? Check out my blog at www.finance-bi.com

Anonymous
Not applicable

I was able to figure it out, thanks LC. I created another measure off this and set to 1 and 0. That llowed me to based my rules on it. Cheers 🙂

I just saw you figured it out. Perfect!

 

LC

Anonymous
Not applicable

Hi LC,

That might work. Is it possible to have multiples of this. For example, using the table below:

 

Capture.PNG

 

  • If Team 1 is chosen then show Target of 90%
  • If Team 1 and Team 5 are chosen show Target of 90%
  • If Team 1 and Team 2 are chosen, then show no target at all

Thanks

Dean

Hi @Anonymous ,

 

 

In that case, you can use the following formula:

Selected Target = 

VAR numberOfTargets = DISTINCTCOUNT(Targets[Target])

RETURN IF (numberOfTargets > 1, BLANK(), DISTINCT('Targets'[Target]))

 

This is what it looks like:

Image 2019-10-29 at 5.06.15 PM.png

And you can download my Power BI example file from here.

 

Does this help you?

 

LC

Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com

Anonymous
Not applicable

Hi LC,

This works perfectly, thanks 🙂Capture.PNG

 

My next problem is how do i use conditional formatting based on this new target field on a stacked column chart?!

I want the columns to be red when its below 99.5% and green when its above. I can create it based on a set target but not based on another field ie the new field that holds the target % above. The conditional Formatting options do not let me base it on this new column/measure.

 

Thanks again

 

 

 

 

Hi @Anonymous ,

 

I am glad it works for you!

 

Can you share a screenshot of your conditional formatting menu?

I just checked (on a different dataset) and I see that I can choose any measure I wish for the data formatting.

 

Below a screenshot.

 

Data formatting.png

 

Let me know,

 

LC

Interested in Power BI and DAX tutorials? Check out my blog at www.finance-bi.com

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.