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.
Hi,
I am trying to set up conditional colouring on a chart based on a measure.
I can do it with a:
Solved! Go to Solution.
Hi @sampak88
Your issue should be caused by ALL function in filter table '2016indx'. ALL function will make your code remove the filter from '2016indx' and due to relationship, your code will remove the filter from 'ZoneLookup' as well. So UR_NAME from ZoneLookup couldn't filter your measure. Try ALLSELECTED finction.
Measure = CALCULATE(AVERAGEX(ALLSELECTED(BUS),BUS[Value]),FILTER(ALLSELECTED('2016indx'),'2016indx'[Category] ="cat1"))
My Sample:
Relationship:
Result is as below. By default result is (1+2+3)/3 = 2. You see we can filter the Avg measure by UR_NAME from ZoneLookup.
(2+3)/2 = 2.5
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@amitchandak - your formula is almost right, the only problem is that when I apply this table3 filter then the AVG calculated stays the same but I would like this to control the group of records. so for table3 cat1 the average is 5 and then for cat2 is 7 and the colour coding is dynamic just for that selection.
Thanks!
Hi @sampak88
Can you share a sample with us? You can show us the result you want by a screenshot. This will make us easier to understand your requirement.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This formula is close:
CALCULATE(AVERAGEX(ALLSELECTED(table),table[Value]),FILTER(all(table2) , table2[Category]="cat1"))
however I have a third table connected that has a another category that should be filtering the AVG instead this remains static when I change the filter, see situation with no filter:
and if I select it (the threshold for colouring remains the same as the average is):
What I would like to have is the AVG being calculated to what the third table provides and the colouring being adjusted so the average is calculated on this subset only.
Thanks!
Hi @sampak88
I think you have created relationships between Table and Table2[Cagetory]/Table3[Cagetory2] . Does your relationship look like my Sample. In my sample Table has Category and Category2.
In my sample this measure works well.
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey,
my relationship looks like this, where in fact the 1 to many in my queries is also 1 to 1
CALCULATE(AVERAGEX(ALLSELECTED(BUS),table[Value]),FILTER(all(2016indx) , 2016indx[Category]="cat1")) and then I want to filter based on UR_NAME from ZoneLookup
Thanks!
Hi @sampak88
Your issue should be caused by ALL function in filter table '2016indx'. ALL function will make your code remove the filter from '2016indx' and due to relationship, your code will remove the filter from 'ZoneLookup' as well. So UR_NAME from ZoneLookup couldn't filter your measure. Try ALLSELECTED finction.
Measure = CALCULATE(AVERAGEX(ALLSELECTED(BUS),BUS[Value]),FILTER(ALLSELECTED('2016indx'),'2016indx'[Category] ="cat1"))
My Sample:
Relationship:
Result is as below. By default result is (1+2+3)/3 = 2. You see we can filter the Avg measure by UR_NAME from ZoneLookup.
(2+3)/2 = 2.5
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@sampak88 , if this measure is issues
try like
CALCULATE(AVERAGEX(ALLSELECTED(table),table[Value]),FILTER(all(table2) , table2[Category]="cat1"))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
117 | |
107 | |
70 | |
70 | |
43 |
User | Count |
---|---|
146 | |
106 | |
104 | |
89 | |
65 |