Forum Discussion
Get a category name with minimum value
Hello,
The measure down below shows how to get category name with maximum value
however I wanted to retrive MIN value. Changed MAX(Fct_Table[Category]) to MIN(Fct_Table[Category]), tried to make TOPN1 DESC/ASC nothing works
Pbiuserr TRy this Measure
MINX ( SUMMARIZE ( Table, Table[GroupBy] , "Measure1",[YourMeasure] ), [Measure1])
Else refer this accepted solution:
12 Replies
- krohitraoRegular Visitor
1. Create a measure for getting max of the change:
MaxChange = CALCULATE(MAX(Fct_Table[Change]), ALL(Fact_Table))
2. Create another measure to get the category with max change:
MaxCategory = CALCULATE(MAX(Fct_Table[Category]), FILTER(Fact_Table, Fct_Table[Change] = [MaxChange]))
Same goes with finding minimum category, create another set of measures and replace MAX with MIN- Pbiuserr
Post Prodigy
Yes but the table in this scenario must consist Fct_Table[Gender] and Fct_Table[Category] and its need to be sorted by [Change] measure. Can you help me build such measure?
Edit: Change is not a Fct_Table[Change], its a measure
- rohit_singh
Solution Sage
Hello Pbiuserr ,
Could you please share sample data in text format along with expected output if possible?
Kind regards,
Rohit- Pbiuserr
Post Prodigy
Hey,
Sory, data is confidential unfortunatelyExpected result is:
You have a table like (I've made it inside the measure)
Gender Category Change Male Category2 10% Female Category1 2% Female Category5 3% Male Category3 7% from that I want retrive name of Category1 as its MIN [Change] (2%). The measure I've put will retrived Category2 as its MAX [Change] (10%). I can make it for MAX but can't for MIN and seek some help
- rohit_singh
Solution Sage
Hi Pbiuserr ,
Please try creating the following measures :Min Change =var _min =CALCULATE(MIN(Gender[Change]),FILTER(ALLSELECTED(Gender), Gender[Gender] = "Female"))var _category =CALCULATE(VALUES(Gender[Category]),FILTER(ALLSELECTED(Gender), Gender[Gender] = "Female" && Gender[Change] = _min))RETURN_categoryMax Change =var _max =CALCULATE(MAX(Gender[Change]),FILTER(ALLSELECTED(Gender), Gender[Gender] = "Female"))var _category =CALCULATE(VALUES(Gender[Category]),FILTER(ALLSELECTED(Gender), Gender[Gender] = "Female" && Gender[Change] = _max))RETURN_category
Final outputKind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊