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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kavitabehera
Advocate II
Advocate II

Calculated minimum value by multiple categories

I wanted to create a calculated table that fetches the minimum value by 2 text columns.

 

For example: Let's take this below example, the question is to bring the minimum sale for the region by category and segment.

The expected answer should be

Central25482.34
East37786.16

kavitabehera_0-1668011602665.png

 

How to generate the correct DAX?

 

Thanks in advance!

 

Note I am trying to create it as a calculated table

 

Tagging a few pro members for support @Anonymous @Bibi @Power5 

 

1 ACCEPTED SOLUTION
v-jialluo-msft
Community Support
Community Support

Hi @kavitabehera ,

 

I think it is just necessary to add another calculation table on top of the example file
(1)
Add a calculation table

Table 2 = SUMMARIZE (
    'Table', 'Table'[Region],
    "MIN",MIN('Table'[MinXSale])
) 

(2)Final output

vjialluomsft_0-1668395965463.png

 

 

Best Regards,

Gallen Luo

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-jialluo-msft
Community Support
Community Support

Hi @kavitabehera ,

 

I think it is just necessary to add another calculation table on top of the example file
(1)
Add a calculation table

Table 2 = SUMMARIZE (
    'Table', 'Table'[Region],
    "MIN",MIN('Table'[MinXSale])
) 

(2)Final output

vjialluomsft_0-1668395965463.png

 

 

Best Regards,

Gallen Luo

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-jialluo-msft
Community Support
Community Support

Hi @kavitabehera ,

 

I tried to open the file link, but it says permission is required.

Please upload the sample file directly to the attachment or remove the access restriction from the download link

 

Best Regards,

Gallen Luo

v-jialluo-msft
Community Support
Community Support

Hi @kavitabehera ,

 

Please follow these steps:

(1) Create a new calculated table

Table 2 = 
SUMMARIZE ( 'Table', 'Table'[Region], "Min", MIN ( 'Table'[Total Sale] ) )

(2) Final output

vjialluomsft_0-1668064018555.png

 

 

According to known data, the minimum value of EAST should be 29870.36,.

if the above resulte is not what you need or I do not understand your need, please indicate the correct approach or provide specific data

 

Best Regards,

Gallen Luo

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for replying.

 

In your case, it worked because we don't have any other columns except these three. But let's assume we have one more column "colors" due to which the minimum value will affect.

kavitabehera_0-1668074114750.png

 

Currently, with this measure, I can summarize region and category by min sales by segment. Here is the snapshot

Table = SUMMARIZECOLUMNS ( Orders[Region], Orders[Category], "MinXSale", MINX ( VALUES ( Orders[Segment] ), [Total Sale] ) ) --Minimum Sale by Segment 

kavitabehera_2-1668073935609.png

 

 

But the answer I am looking for is 

Central25482

East

29870West33638South16853

 

 

Here is the dataset link that will help you recreate the situation.

https://drive.google.com/file/d/1xGwidMFLevCFmp9OQHjSvlj-skPZEATn/view?usp=sharing

 

Greg_Deckler
Super User
Super User

@kavitabehera This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.


@ 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 

 

Thank you for your response. 

 

The case I am trying to achieve is when I want "Region minimum sale by 2 categories (Category & Segment)". Through the above DAX I can add and create something like "Region & Category minimum sale by Segement."

 

The DAX I used

Table = SUMMARIZECOLUMNS (
    Orders[Region],
    Orders[Category],
    "MinXSale", MINX ( VALUES ( Orders[Segment] ), [Total Sale] )
) --Minimum Sale by Segement
 
Result
kavitabehera_1-1668074648808.png

 

This is not what I want, I only want the region and its highlighted values. 

 

Here is the link to the dummy PBIX file.

Power BI File 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors