Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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 3
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 

 

aqsa31_0-1681464084099.png

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

 

aqsa31_1-1681464137936.png

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)
v-zhangti
Community Support
Community 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
Not applicable

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

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.