Forum Discussion
power bi loop
- 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
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
Thanks a lot It's really helpful
But i need the measure value in a column to use it on the shape map
Is there any way to so