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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MasterSonic
Helper IV
Helper IV

Sum unique value in column per category

Hello,

 

having this table :
Code Group Processing Status

101Jeans1Ordered
101Jeans1Ordered
102Jeans1In Delivery
103Shirt3In Delivery
104Shirt3In Delivery
105Shirt3In Delivery
106Shirt3Sold
107Shoe66Sold



I have this measurment :

 

 

Status count per Code = var _status = SELECTEDVALUE('Table'[Status])
var _processing =SUMX(SUMMARIZE('Table','Table'[Group],'Table'[Processing]),'Table'[Processing])
var _t=DISTINCT(SELECTCOLUMNS( FILTER( ALLSELECTED('Table') ,'Table'[Status]=_status) , "Code" , [Code]))
return
IF(_status ="Sold" , _processing , COUNTROWS(_t))

 

 

_processing show  70 on it's own- correct,
but with other values just 69, how to get value 70 here?
MasterSonic_0-1669455186087.png

 



 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @MasterSonic 

please try

Status count per Code =
VAR _status =
SELECTEDVALUE ( 'Table'[Status] )
VAR _processing =
SUMX (
SUMMARIZE ( ALLSELECTED ( 'Table' ), 'Table'[Group], 'Table'[Processing] ),
'Table'[Processing]
)
VAR _t =
DISTINCT (
SELECTCOLUMNS (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Status] = _status ),
"Code", [Code]
)
)
RETURN
IF ( _status = "Sold", _processing, COUNTROWS ( _t ) )

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @MasterSonic 

please try

Status count per Code =
VAR _status =
SELECTEDVALUE ( 'Table'[Status] )
VAR _processing =
SUMX (
SUMMARIZE ( ALLSELECTED ( 'Table' ), 'Table'[Group], 'Table'[Processing] ),
'Table'[Processing]
)
VAR _t =
DISTINCT (
SELECTCOLUMNS (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Status] = _status ),
"Code", [Code]
)
)
RETURN
IF ( _status = "Sold", _processing, COUNTROWS ( _t ) )

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.