Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Uzi2019
Super User
Super User

Min and Max of the same column for calculation

Hi Experts,

I want to calculate MAX and MIN value of the Profit column with respect to the values selected in Slicer available. Attaching sample data here.

Slicer/Fiters on page: Region, Targets, Week

Measure to calculate: Divide( (Profit - MIN of Profit), (MAX of Profit - MIN of Profit ) )

 

RegionsCategoryProfitTargetWeek
West1010.000215A1
West1020.000277B1
West1030.000323C2
West1040.00017A2
West1050.000189B3
West1060.000225C3
West1070.000217A4
West1080.000167B4
West1090.000129C5
West1100.000179A5
West1110.000176B6
West1120C6
West1138.06E-05A7
East1140.00017B1
East1150.000164C1
East1160A2
East1170.001332B2
East1180.002236C3
East1190.002129A4
East1200.001288B5
East1210.001217C6
North1220.001057A1
North1230.001839B1
North1240.000703C2
North1250.000653A2
North1260.000958B3
North1270.000332C4
North1280.000684A5
North1290.000743B6
North1300.000887C7
North1310.001415A7
South1320.000582B1
South1330.00084C1
South1340.00027A2
South1350.001124B2
South1360.001124C3
South1370.000514A4
South1380.000697B5
South1390.000652C6
South1400.000336A7
South1410.000469B7
South1420.000319C7
Don't forget to give thumbs up and accept this as a solution if it helped you!!!
2 ACCEPTED SOLUTIONS

@Uzi2019 Oh, just use MINX(ALLSELECTED('Table'),[Profit])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

@Uzi2019 You can also try this measure:

 MIN Profit = CALCULATE (
    MINX (
        SUMMARIZE (
            Table,
           Table[Regions],
           Table[Category],
            "MIN_", SUM ( Table[Profit] )
        ),
        [MIN_]
    ),
    ALLSELECTED ( Table )
)
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

@Uzi2019 Try:

Measure to calculate: DIVIDE( MIN('Table'[Profit]), MAX('Table'[Profit]) - MIN('Table'[Profit]) )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thanks for your reply. But when made the selection from top slicers available so it should compute MIN and MAX overall. Like If Region selects as South so overal MIN value of South shoudl get computed like wise for MAX. I think we should leverage MINX and MAXX for this but I am getting wrong answers that's why I hope community would help me. 😀

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

@Uzi2019 I am attaching sample PBIX file below signature. Perhaps I am not understanding your requirements but the calculation seems to work for me.

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thanks for your efforts. I gues we are closer to the solution. To demystify the actual requirement I am attaching below screen shot for your reference and added note alsoin text box. 
Let's break them into two measures for MIN and MAX. and I need same MIN values in all rows (may be to use ALLSelected or RemoveFilters). right now which is coming in only grand total row but this value I need in all rows as per the slicers selection.
Let me know incase of any doubts.

 

MicrosoftTeams-image (6).png

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

@Uzi2019 You can also try this measure:

 MIN Profit = CALCULATE (
    MINX (
        SUMMARIZE (
            Table,
           Table[Regions],
           Table[Category],
            "MIN_", SUM ( Table[Profit] )
        ),
        [MIN_]
    ),
    ALLSELECTED ( Table )
)
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

@Uzi2019 Oh, just use MINX(ALLSELECTED('Table'),[Profit])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 
Your solution is working fine for sample data. But when I applied it to an actual data this is not giving correct result. 
Thank you so much for your efforts.

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.