Forum Discussion
How to plot maximum/minimum value plot for selected item's category
- 4 years ago
Try the following change:
Maximum = VAR CategorySelection = VALUES( TableDimension[Category] ) RETURN CALCULATE ( MAX ( Table[Sales] ), FILTER ( ALL ( TableDimension ), TableDimension[Category] in CategorySelection ) ) - 4 years ago
Hi Maggi029 ,
Try to change the metric of the max/min to somwething similar to this:
Maximum = VAR CategorySelection = VALUES( TableDimension[Category] ) var ItemValues = CALCULATE ( DISTINCTCOUNT ( Table[Item] ), FILTER ( ALL ( TableDimension ), TableDimension[Category] in CategorySelection ) ) RETURN IF(ItemValues > 1, CALCULATE ( MAX ( Table[Sales] ), FILTER ( ALL ( TableDimension ), TableDimension[Category] in CategorySelection ) ) )This should return blank for the maximum and minimum when there is only a single value so the labels will not appear.
Thanks for response, You measure is working fine, but I have one special case
Case : Because one of the items belongs to two categories, "SELECTEDVALUE" does not return the expected value because it has two values.
Can suggest how to handle above case?
Try the following change:
Maximum =
VAR CategorySelection =
VALUES( TableDimension[Category] )
RETURN
CALCULATE (
MAX ( Table[Sales] ),
FILTER ( ALL ( TableDimension ), TableDimension[Category] in CategorySelection )
)- Maggi0294 years agoHelper II
Thanks for for you help, your solution working fine.
Also i have one more query related to this, if a category has only one value, the Maximum and Minimum data points will be the same, making the group look crowded with the same value repeated when Data label is enabled. How can this be limited in this case by showing only one data label?- MFelix4 years agoSuper User
Hi Maggi029 ,
Try to change the metric of the max/min to somwething similar to this:
Maximum = VAR CategorySelection = VALUES( TableDimension[Category] ) var ItemValues = CALCULATE ( DISTINCTCOUNT ( Table[Item] ), FILTER ( ALL ( TableDimension ), TableDimension[Category] in CategorySelection ) ) RETURN IF(ItemValues > 1, CALCULATE ( MAX ( Table[Sales] ), FILTER ( ALL ( TableDimension ), TableDimension[Category] in CategorySelection ) ) )This should return blank for the maximum and minimum when there is only a single value so the labels will not appear.
- Maggi0294 years agoHelper II
MFelix Can you please look into this and provide your suggestion for this
How to find the maximum value of a measure in tabl... - Microsoft Power BI Community