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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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])



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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]) )


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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.

 



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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])



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.