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
Natalia1234
Regular Visitor

ISFILTERED with interacting graphs

Hello, I have two interacting graphs: line chart with 3 points (at Q4 2018, Q1 2019 and Q2 2019) and a donut chart. When I click to the data point on the line graph (picking Q2 2019, for example), my donut chart is adjusting, showing the data breakdown for this quarter. The issue is following: if I do not choose particularly any of the quarters on a line graph (so all of them is selected), my donut chart show the aggregate breakdown, summing all 3 quarters. What I need is that if no particular point on a line graph is chosen, the donut chart shows the breakdown of Q2 2019 ONLY. First option is to make a button with "please pick a quarter" inscription, but I wonder whether it is possible to fix the graph on Q2 2019 in case no other particular quarter is chosen.

 

I guess, it should be logically like this: "if(table has a filter; show this filter;  filter the last recent quarter)". The first step I think can be solved with "ISFILTERED". As a result, I wrote this, but it returns an error "Argument '2' in IF function is required.". Here is my code:
Measure = IF(ISFILTERED('Table_for_line_chart'[Quarter]);;FILTER('table_for_donut_chart';'table_for_donut_chart'[Quarter]="2019 Q2"))

I guess the problem is that It do nothing in case of Isfiltered = true. Or should I use the table_for_donut_chart'[Quarter] in ISFILTERED instead? Also it is not clear what should I do with such a measure: should I just add it on a donut chart or replace the quarter with it..?

 

Many thanks for your help!!
Natalia

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @Natalia1234 ,

 

Based on my test, you could create a measure and put it into the values of the donut chart. The following is my sample you can have a try.

Measure = 
var maxd = CALCULATE(MAX('Table1'[Date]),ALL(Table1))
var a = SELECTEDVALUE('Table1'[Date])
var b = CALCULATE(SUM(Table1[Values]),FILTER('Table1',Table1[Date] = a))
var c = CALCULATE(SUM(Table1[Values]),FILTER(Table1,Table1[Date] = maxd))
return  
IF(ISFILTERED('Table1'[Date]),b,c)

1.PNG

2.PNG

Best Regards,

Xue Ding

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

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

View solution in original post

2 REPLIES 2
v-xuding-msft
Community Support
Community Support

Hi @Natalia1234 ,

Could you tell me if your problem has been solved? If it is, kindly mark the helpful answer as a solution if you feel that makes sense. Welcome to share your own solution. More people will benefit from here.

 

Best Regards,

Xue

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

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-xuding-msft
Community Support
Community Support

Hi @Natalia1234 ,

 

Based on my test, you could create a measure and put it into the values of the donut chart. The following is my sample you can have a try.

Measure = 
var maxd = CALCULATE(MAX('Table1'[Date]),ALL(Table1))
var a = SELECTEDVALUE('Table1'[Date])
var b = CALCULATE(SUM(Table1[Values]),FILTER('Table1',Table1[Date] = a))
var c = CALCULATE(SUM(Table1[Values]),FILTER(Table1,Table1[Date] = maxd))
return  
IF(ISFILTERED('Table1'[Date]),b,c)

1.PNG

2.PNG

Best Regards,

Xue Ding

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

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

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.