Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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?!

 

 

  • 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

8 Replies

  • 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's avatar
      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 🙂

      • lc_finance's avatar
        lc_finance
        Icon for Solution Sage rankSolution Sage

        I just saw you figured it out. Perfect!

         

        LC

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi LC,

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

       

       

      • 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

      • lc_finance's avatar
        lc_finance
        Icon for Solution Sage rankSolution Sage

        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:

        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

  • Icey's avatar
    Icey
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

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

     

    Best Regards,

    Icey