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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Nobie
Helper II
Helper II

Max Based on Category

Hi  experts,
i need to create 2 simple measure need help!!!

Below Measure 1: Its actually max value of taget for each city   partition by conusmer segment.
Measure 2: It is name of segment which gives max values.

Note : Here Target is a calculated measure not directly coming from database.

Nobie_0-1694021413556.png

Please let me know any dax function which can help to achieve,
thanks.
Please use the PBIX=> pbix 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Please find attached the PBI file.

Hope this helps.

Ashish_Mathur_0-1694056104717.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Please find attached the PBI file.

Hope this helps.

Ashish_Mathur_0-1694056104717.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
gmsamborn
Super User
Super User

Hi @Nobie 

 

Would something like this work?

Measure1 = 
    CALCULATE(
        MAX( 'Targets'[Target] ),
        ALLEXCEPT( 'Targets', 'Targets'[City] )
    )

Measure2 = 
    CALCULATE(
        MAX( 'Targets'[Customer Segment] ),
        FILTER(
            ALLEXCEPT( 'Targets', 'Targets'[City] ),
            'Targets'[Target] = [Measure1]
        )
    )


Proud to be a Super User!

daxformatter.com makes life EASIER!

Not working

Hi @Nobie 

Maybe try this

 

Measure1 = 
    CALCULATE(
        MAX( 'Targets'[Target] ),
        ALL( 'Targets'[Customer Segment] )
    )

Measure2 = 
    CALCULATE(
        MAX( 'Targets'[Customer Segment] ),
        FILTER(
            ALL('Targets'[Customer Segment], 'Targets'[Target] ),
            'Targets'[Target] = [Measure1]
        )
    )

 

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

hi @gmsamborn ,
thanks fro helping but this also didn't work,
i am attaching the pbix here plz download PBix 

Do you have additional columns besides the 3 in your example?

 

If so, can you show the following?

 

1)  Please provide sample data that covers your issue or question completely.  
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...

 

2) Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

 

3) Please explain how you would expect to get from step 1 to 2.

 

My pbix: Max Based on Category.pbix

 

I hope this helps.



Proud to be a Super User!

daxformatter.com makes life EASIER!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.