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
JMcAnarney1
Helper I
Helper I

Writing Formula to show MAX and MIN

How can I write a formula for a new table to show the MAX and MIN for each bid event in a seperate column? For example. How can I show the Max and MIN for bid event 2506 that IS NOT the engineering estimate?

 

JMcAnarney1_0-1676304042988.png

 

1 ACCEPTED SOLUTION

Hi @JMcAnarney1 ,

 

Please try:

 

Highest Bidder = 
VAR _table =
    CALCULATETABLE (
        ADDCOLUMNS (
            SUMMARIZE ( 'Bid Data', 'Bid Data'[Bid Listing], 'Bid Table'[Bidder] ),
            "@Cost", [List of Bids]
        ),
        ALLSELECTED ( 'Bid Table'[Bidder] )
    )
VAR _max =
    MAXX ( _table, [@Cost] )
RETURN
    IF ( [List of Bids] && [List of Bids] = _max, _max )
Lowest Bidder = 
VAR _table =
    CALCULATETABLE (
        ADDCOLUMNS (
            SUMMARIZE ( 'Bid Data', 'Bid Data'[Bid Listing], 'Bid Table'[Bidder] ),
            "@Cost", [List of Bids]
        ),
        ALLSELECTED ( 'Bid Table'[Bidder] )
    )
VAR _min =
    MINX ( _table, [@Cost] )
RETURN
    IF ( [List of Bids] && [List of Bids] = _min, _min )

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

9 REPLIES 9
JMcAnarney1
Helper I
Helper I

So i get the #2 formula but herre is what I have for the first: 

 

Highest Bidder 1 =
VAR _table = CALCULATETABLE(ADDCOLUMNS(SUMMARIZE('Bid Data','Bid Data'[Bid Listing]),"Total Costs",'Bid Data'[List of Bids]),ALLSELECTED('Bid Data'[Bidder]))
VAR _max = MAXX('Bid Data',[List of Bids])
RETURN
_max
 
However that is not matching my List of bids numbers adjacent to it:JMcAnarney1_0-1676473903197.png

 

 

Is there a way I can attach my file?

v-cgao-msft
Community Support
Community Support

Hi @JMcAnarney1 ,

 

Please refer to the simple file:

vcgaomsft_0-1676344334058.png

Measure = 
VAR _year = SELECTEDVALUE('financials'[Year])
VAR _word = SELECTEDVALUE('Table'[Column1])
VAR _result = 
SWITCH(
    _word,
    "MIN",
    MINX(FILTER(SUMMARIZE('financials','financials'[Year],'financials'[Country],"S",[Sales]),'financials'[Year]=_year),[S]),
    "MAX",
    MAXX(FILTER(SUMMARIZE('financials','financials'[Year],'financials'[Country],"S",[Sales]),'financials'[Year]=_year),[S])
)
RETURN
_result

vcgaomsft_1-1676344372736.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

I get this but i want it as it's own measure in column seperate out i.e. Min would be a column as with MAx:

JMcAnarney1_0-1676414626264.png

 

So in picture case the highest bidder for 2167 was bettis so they should only appear in blank highest bidder column

Hi @JMcAnarney1 ,

 

I updated the model.

vcgaomsft_0-1676428689557.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

So i get the #2 formula but herre is what I have for the first: 

 

Highest Bidder 1 =
VAR _table = CALCULATETABLE(ADDCOLUMNS(SUMMARIZE('Bid Data','Bid Data'[Bid Listing]),"Total Costs",'Bid Data'[List of Bids]),ALLSELECTED('Bid Data'[Bidder]))
VAR _max = MAXX('Bid Data',[List of Bids])
RETURN
_max
 
However that is not matching my List of bids numbers adjacent to it:JMcAnarney1_0-1676481668850.png

 

 

 

Is there a way I can attach my file?

Hi @JMcAnarney1 ,

 

You can link to a cloud file. Make sure the file doesn't contain any sensitive data before you make it public.

How to provide sample data in the Power BI Forum

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi @JMcAnarney1 ,

 

Please try:

 

Highest Bidder = 
VAR _table =
    CALCULATETABLE (
        ADDCOLUMNS (
            SUMMARIZE ( 'Bid Data', 'Bid Data'[Bid Listing], 'Bid Table'[Bidder] ),
            "@Cost", [List of Bids]
        ),
        ALLSELECTED ( 'Bid Table'[Bidder] )
    )
VAR _max =
    MAXX ( _table, [@Cost] )
RETURN
    IF ( [List of Bids] && [List of Bids] = _max, _max )
Lowest Bidder = 
VAR _table =
    CALCULATETABLE (
        ADDCOLUMNS (
            SUMMARIZE ( 'Bid Data', 'Bid Data'[Bid Listing], 'Bid Table'[Bidder] ),
            "@Cost", [List of Bids]
        ),
        ALLSELECTED ( 'Bid Table'[Bidder] )
    )
VAR _min =
    MINX ( _table, [@Cost] )
RETURN
    IF ( [List of Bids] && [List of Bids] = _min, _min )

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.