Forum Discussion
BIswajit_Das
3 years agoImpactful Individual
power bi loop
Present data id response 1 a 1 b 1 a 2 a 3 b Required Data id response Maxcountbasedata 1 a a 1...
- Anonymous3 years ago
Hi BIswajit_Das ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a calculated column as below to get the count of per response under per id
Count = CALCULATE ( COUNT ( 'Table'[response] ), FILTER ( 'Table', 'Table'[id] = EARLIER ( 'Table'[id] ) && 'Table'[response] = EARLIER ( 'Table'[response] ) ) )2. Create a measure as below to get the response which have the max count
Maxcountbasedata = VAR _selid = SELECTEDVALUE ( 'Table'[id] ) VAR _count = CALCULATE ( MAX ( 'Table'[Count] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[id] = _selid ) ) RETURN CALCULATE ( MAX ( 'Table'[response] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[id] = _selid && 'Table'[Count] = _count ) )Best Regards
- Anonymous3 years ago
Hi BIswajit_Das ,
You can create a calculated column as below to replace the measure, please find the details in the attachment.
Column = VAR _count = CALCULATE ( MAX ( 'Table'[Count] ), FILTER ( 'Table', 'Table'[id] = EARLIER ( 'Table'[id] ) ) ) RETURN CALCULATE ( MAX ( 'Table'[response] ), FILTER ( 'Table', 'Table'[id] = EARLIER ( 'Table'[id] ) && 'Table'[Count] = _count ) )Best Regards
Anonymous
3 years agoNot applicable
Hi BIswajit_Das ,
You can create a calculated column as below to replace the measure, please find the details in the attachment.
Column =
VAR _count =
CALCULATE (
MAX ( 'Table'[Count] ),
FILTER ( 'Table', 'Table'[id] = EARLIER ( 'Table'[id] ) )
)
RETURN
CALCULATE (
MAX ( 'Table'[response] ),
FILTER (
'Table',
'Table'[id] = EARLIER ( 'Table'[id] )
&& 'Table'[Count] = _count
)
)
Best Regards
BIswajit_Das
3 years agoImpactful Individual
Thanks it's really helpfull