Forum Discussion
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
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.
- AnonymousNot applicable
Hi v-zhangti thanks for the reply, I have updated my question
- AnonymousNot applicable
So this is the sample data I have
Session date Client Programme Event NPS 12/3/2022 Client 1 Prog C1 1 Skills for tomorrow 7 12/3/2022 Client 1 Prog C1 1 Skills for tomorrow 4 14/3/2022 Client 1 Prog C1 3 CV writing 6 14/3/2022 Client 1 Prog C1 3 CV writing 9 16/3/2022 Client 2 Prog C2 1 Digital Marketing 16/3/2022 Client 2 Prog C2 1 Digital Marketing 16/3/2022 Client 2 Prog C2 1 Audience developemnt 7 16/3/2022 Client 2 Prog C2 1 Audience developemnt 10 12/3/2023 Client 2 Prog C2 1 Marketing techniques 9 12/3/2023 Client 2 Prog C2 1 Marketing techniques 3 12/3/2023 Client 2 Prog C2 1 Marketing techniques 2 12/3/2023 Client 2 Prog C2 1 Marketing techniques 0 21/3/2023 Client 2 Prog C2 2 Marketing 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-10VAR _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 typeVAR 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 scoreNext, 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 visualDistinct 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)