Forum Discussion
Anonymous
2 years agoNot applicable
How to get unique values(materials)
Hi, I'm new to PowerBi and DAX. Would like to ask for help on how to get unique count of the materials depending on the status. Example: material 1028530, if all rows is Released then count a...
- Anonymous2 years ago
Hi Anonymous ,
You can try formula like below:
result_ = VAR table_ = SUMMARIZE ( YourTable, YourTable[Material], "Status", IF ( COUNTROWS ( FILTER ( YourTable, YourTable[PRStatus] = "Released" ) ) = COUNTROWS ( YourTable ) && NOT ( ISBLANK ( FIRSTNONBLANK ( YourTable[PRNo], 1 ) ) ), "Released", IF ( COUNTROWS ( FILTER ( YourTable, YourTable[PRStatus] = "Partially Released" ) ) > 0, "Partially Released", IF ( COUNTROWS ( FILTER ( YourTable, ISBLANK ( YourTable[PRNo] ) ) ) = COUNTROWS ( YourTable ), "Unreleased", BLANK () ) ) ) ) RETURN if(HASONEVALUE(YourTable[PRStatus]),CALCULATE ( COUNTROWS ( table_ ) ),BLANK())Best Regards,
Adamk KongIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Idrissshatila
2 years agoSuper User
HEllo Anonymous ,
but as per your data here, for example the distinct material for released are 8 not 5 as you can see.
Anonymous
2 years agoNot applicable
Hello Idrissshatila
This is the breakdown.
Only count as Released if all status is Released and only count in Unreleased if all status is blank otherwise Partial Released.