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
anandsoftweb
Helper II
Helper II

Min value count data in DAX

Hello,

 

I want dax calculation for min status value from specific Item Segment

 

below is my sample data.

 

 

IdItemSub ItemItem StatusDescription for Count the ValueExpected Result/OP In DAX As below 
1Item11100For Item 1 Min Status is 0Total Count of Status 0 = 2
1Item11111  
1Item21120For Item 2 Min Status is 0 
1Item21131  
1Item21142  
1Item31151For Item 3 Min Status is 1Total Count of Status 1 =2
1Item31162  
1Item31173  
1Item41181For Item 3 Min Status is 1 
1Item41192  
1Item51202For Item 5 Min Status is 2Total Count of Status 2 =1
1Item51213  

 

So final Out put should be in count and I would like to display in Bar Chart By Status Count like

 

Eg,

Status 0 :- 10 Count,

Status 1 :- 20 Count, 

Status 2 :- 15 Count, 

Status 3 :- 20 Count

 

From above table

 

Thanks In Advance 

 

1 ACCEPTED SOLUTION

@anandsoftweb

I really think these should work! Smiley Happy

 

NEW Measure (Min Status) = 
CALCULATE ( MIN ( 'NewTable'[Item Status] ), ALLEXCEPT ( 'NewTable', 'NewTable'[Item], 'NewTable'[Id] ) )

NEW Measure (Count of Status) = CALCULATE ( COUNTA ( 'NewTable'[Item Status] ), FILTER ( 'NewTable', 'NewTable'[Item Status] = [NEW Measure (Min Status)] ), ALLEXCEPT ( 'NewTable', 'NewTable'[Item], NewTable[Id] ) )

 

Good Luck!Smiley Happy

View solution in original post

3 REPLIES 3
Sean
Community Champion
Community Champion

@anandsoftweb

These 2 Measures work with the sample data

 

Measure (Min Status) = 
CALCULATE ( MIN ( 'Table'[Item Status] ), ALLEXCEPT ( 'Table', 'Table'[Item] ) )

Measure (Count of Status) = 
CALCULATE (
    COUNTA ( 'Table'[Item Status] ),
    FILTER ( 'Table', 'Table'[Item Status] = [Measure (Min Status)] ),
    ALLEXCEPT ( 'Table', 'Table'[Id] )
)

And the results...

 

Min Status and Count of Status.png

Hope this helps!

Good Luck! Smiley Happy

 

@Sean ,

 

Thanks for your quick reply and DAX calculation its near up to the solution, its really helpful but for multiple id and total count is not matched.

 

Here ID should be 2,3,4.... like wise and total (Measure (Count of Status )) should be match with total Item count like as below

 

Item 1 has Item Status 0 as a Min

Item 2 has Item Status 1 as a Min

Item 3 has Item Status 2 as a Min

Item 4 has Item Status 0 as a Min 

Item 5 has Item Status 1 as a min

 

So

total 5 items and I

Item Status 0 = 2

Item Status 1 = 2

Item Status 2 = 1

 

So total should be 5 at the end

 

In sample data it works ut in case of multiple ID its not working. while selecting id

 

I think there should be minor change in calculation so here you can help out.

 

If possible pls help here 

 

Thanks once again 🙂

 

Note:-1 It should be distinct count  

 

@anandsoftweb

I really think these should work! Smiley Happy

 

NEW Measure (Min Status) = 
CALCULATE ( MIN ( 'NewTable'[Item Status] ), ALLEXCEPT ( 'NewTable', 'NewTable'[Item], 'NewTable'[Id] ) )

NEW Measure (Count of Status) = CALCULATE ( COUNTA ( 'NewTable'[Item Status] ), FILTER ( 'NewTable', 'NewTable'[Item Status] = [NEW Measure (Min Status)] ), ALLEXCEPT ( 'NewTable', 'NewTable'[Item], NewTable[Id] ) )

 

Good Luck!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.