Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Display chart based on slicer value

I have created two charts to display the NPS scores of clients, One is a line chart showing the NPS score over multiple years and the other is a tachometer chart to display the NPS score,

Now, if I select a client name from a slicer 'Client 1' there are three possibilities here 

  • The client's NPS score is blank (No data)
  • The client's NPS score is available for one year only, say out of years 2020 - 2023 we have the NPS score for the year 2021 only 
  • We have NPS scores for multiple years 

 

For each of the possibilities I want to display different output 

  • I have already done this , if the output is blank I am displaying no data message using conditional formatting 
  • If only one-year data is available then instead of a single dot on the chart I want to display the tachometer viz 
  • If multiple years of data are available I want to show the line chart

 

Is it possible to display or hide visuals based on the conditions using dax? I have an event date column with the all the dates and can use that to extract the year 

3 Replies

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

     

    Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures or Excel. I look forward to your response.

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-zhangti thanks for the reply, I have updated my question

  • Anonymous's avatar
    Anonymous
    Not applicable

    So this is the sample data I have 

     

    Session dateClientProgrammeEventNPS
    12/3/2022Client 1Prog C1 1Skills for tomorrow7
    12/3/2022Client 1Prog C1 1Skills for tomorrow4
    14/3/2022Client 1Prog C1 3CV writing6
    14/3/2022Client 1Prog C1 3CV writing9
    16/3/2022Client 2Prog C2 1Digital Marketing 
    16/3/2022Client 2Prog C2 1Digital Marketing 
    16/3/2022Client 2Prog C2 1Audience developemnt7
    16/3/2022Client 2Prog C2 1Audience developemnt10
    12/3/2023Client 2Prog C2 1Marketing techniques9
    12/3/2023Client 2Prog C2 1Marketing techniques3
    12/3/2023Client 2Prog C2 1Marketing techniques2
    12/3/2023Client 2Prog C2 1Marketing techniques0
    21/3/2023Client 2Prog C2 2Marketing techniques

     

    Each row is a feedback response from our learners and NPS is basically the NPS score. What I want is that if data filtered in the slicers (Client, program, event) and the year is one single year I show Tachometer like this 

     

    But if multiple years are selected for say one client or multiple clients it should show a line chart like this 

     

    and if no data is available it should show the message 'No data found'

     

    Hope it helps? v-zhangti 

     

    These are the measures I am using so far 

     

    for NPS: 

     

    NPS Score second =
    //be sure you have a question in your survey asking "How likely would you be to recommend us?" with a scale of 0-10
    VAR _tbl= FILTER('Merged',NOT(ISBLANK('Merged'[How likely are you to recommend the session?])))
    VAR detractors = COUNTROWS(FILTER(_tbl,'Merged'[How likely are you to recommend the session?]<=6))
     

    //don't forget to make your NPS question column into a whole number data type
    VAR passives =COUNTROWS(FILTER(_tbl,'Merged'[How likely are you to recommend the session?]=7||'Merged'[How likely are you to recommend the session?]=8))
             
    VAR promoters =COUNTROWS(FILTER(_tbl,'Merged'[How likely are you to recommend the session?]>=9))
     

    VAR total = COUNTROWS(_tbl)
     

    VAR score = (promoters/total*100)-(detractors/total*100)
    RETURN score
     
    Next, I am using a simple measure and some conditional formatting to show the no data message. 
     
    I am using this measuere to show and hide a visual
     
    Distinct Years =
    CALCULATE(
        DISTINCTCOUNT(Merged[Session Date].[Year]),
        FILTER(Merged, NOT(ISBLANK(Merged[NPS])))
    )
     
    hide = if(CALCULATE(SUMX(VALUES(Merged[Client]),[Distinct Years]),ALLSELECTED(Merged)) > 1,1,0)