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

How to return min value for different groups of data

Hello.

 

I am working with a set of data simliar to this:

 

TASK	CONFIG	    ID	EXPECTED OUTPUT
Task A	Config A    1 	1
Task A	Config A    2	1
Task A	Config A    3	1
Task A	Config B    4	4
Task A	Config B    5	4
Task A	Config B    6	4
Task B	Config A    7	7
Task B	Config A    8	7
Task B	Config A    9	7
Task B	Config B   10	10
Task B	Config B   11	10
Task B	Config B   12	10

 

My problem is: how do i get the EXPECTED OUTPUT value?

EXPECTED OUTPUT = The lowest ID for each existing combination of TASK and CONFIG

I need this either as a NEW COLUMN or via Power Query M instead of DAX. It can't be a CALCULATED MEASURE because I need to change the datacategory of the EXPECTED OUTPUT to be a Web URL, which is not possible with calculated measures.

 

After that I would like to hide the ID value from a "Table" visualisiation and just have this left:

TASK	CONFIG	    EXPECTED OUTPUT
Task A	Config A    1
Task A	Config B    4
Task B	Config A    7
Task B	Config B    10

 

Thank you.

1 ACCEPTED SOLUTION

HI @love

 

Try this

 

Column =
CALCULATE (
    MIN ( TableName[ID] ),
    ALLEXCEPT ( TableName, TableName[TASK], TableName[CONFIG] )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
love
Helper I
Helper I

/friendly push Cat Happy

HI @love

 

Try this

 

Column =
CALCULATE (
    MIN ( TableName[ID] ),
    ALLEXCEPT ( TableName, TableName[TASK], TableName[CONFIG] )
)

Regards
Zubair

Please try my custom visuals

@love

 

Using Power Query / Query  Editor

 

Go to Transform Tab>>>Group By>>Advanced

 

See the pic below

 

PQGroup.png


Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad

 

Both of your suggested solutions perfectly meet the requirements in my OP, thank you very much for the uncomplicated and elegand suggestions! 

 

I ended up going for the DAX solution because if I use the "Group by" solution in the query editor the grouping actually removes all lines that do not have the MIN(ID) which is not what I want but I see that I did not make that very clear in my OP.

 

Thanks again! Smiley Happy

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.