Forum Discussion
vin26
Resolver I
6 years agoDynamic category on slicer section
Hello, Please help me in creating a creating catogaries based on the mid point selections. For below scatter cart X and Y axis are calculated based on the slicers in left. If the Midpoint1 = ...
- 6 years ago
vin26 , you have to create a measure like this example measure and use that in conditional formatting
Color Dot = var _avgDisc = CALCULATE([Discount %],ALL(Retail)) var _avgMargin = CALCULATE([Margin %],ALL(Retail)) return switch(TRUE(), [Margin %]>_avgMargin && [Discount %] <_avgDisc , "Green", [Margin %]>_avgMargin && [Discount %] >_avgDisc , "Blue", [Margin %]<_avgMargin && [Discount %] <_avgDisc , "Yellow", [Margin %]<_avgMargin && [Discount %] >_avgDisc , "Red", "Black")I have explained how to do it in this webinar
- 6 years ago
vin26 - I think it is because of your logical expressions, perhaps:
Measure = var _avgDisc = CALCULATE('Midpoint1_X Axis'[Midpoint1 Value],ALL(Data)) var _avgMargin = CALCULATE('Midpoint2_Y Axis'[Midpoint2 Value],ALL(Data)) return switch(MAX('Table'[Category]), "A",CALCULATE(COUNT(Data[Sl No]),FILTER(Data,[Measure_Value1]>_avgMargin && [Measure_Value2] <_avgDisc)), "B",CALCULATE(COUNT(Data[Sl No]),FILTER(Data,[Measure_Value1]>_avgMargin && [Measure_Value2] >_avgDisc)), "C",CALCULATE(COUNT(Data[Sl No]),FILTER(Data,[Measure_Value1]<_avgMargin && [Measure_Value2] <_avgDisc)), "D",CALCULATE(COUNT(Data[Sl No]),FILTER(Data,[Measure_Value1]<_avgMargin && [Measure_Value2] >_avgDisc)) )If not, maybe try eliminating some CALCULATE statements:
Measure = var _avgDisc = CALCULATE('Midpoint1_X Axis'[Midpoint1 Value],ALL(Data)) var _avgMargin = CALCULATE('Midpoint2_Y Axis'[Midpoint2 Value],ALL(Data)) return switch(MAX('Table'[Category]), "A",COUNTROWS(FILTER(Data,[Measure_Value1]>_avgMargin && [Measure_Value2] <_avgDisc)), "B",COUNTROWS(FILTER(Data,[Measure_Value1]>_avgMargin && [Measure_Value2] >_avgDisc)), "C",COUNTROWS(FILTER(Data,[Measure_Value1]<_avgMargin && [Measure_Value2] <_avgDisc)), "D",COUNTROWS(FILTER(Data,[Measure_Value1]<_avgMargin && [Measure_Value2] >_avgDisc)) )
Anonymous
6 years agoNot applicable
Hi vin26 ,
As @Greg_Deckler said ,you could use SWITCH() or use IF()function like this:
categoryType =
IF (
[forX] >= 0
&& [forX] <= 140
&& [forY] >= 0
&& [forY] <= 120,
"Categoty A",
IF (
[forX] > 140
&& [forY] >= 0
&& [forY] >= 0
&& [forY] <= 120,
"Category B",
IF (
[forX] > 140
&& [forY] > 120,
"Category C",
IF ( [forX] >= 0 && [forX] <= 140 && [forY] > 120, "Category D" )
)
)
)Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Eyelyn Qin