Forum Discussion
powerbi_bi
9 years agoFrequent Visitor
Create a FLAG column with 1 or 0
Hi, I have a table ID CASE_ID COUNTRY 1 AAA USA 1 AAA JAPAN 1 AAA CHINA 2 BBB CHINA 2 BBB CHINA 2 BBB CHINA 2 BBB CHINA 3 CCC USA 3 CCC JAPAN ...
- 9 years ago
powerbi_bi This should work :smileyhappy:
Flag Column = IF ( CALCULATE ( DISTINCTCOUNT ( 'Table'[COUNTRY] ), ALLEXCEPT ( 'Table', 'Table'[CASE_ID] ) ) = 1, 0, 1 )
Sean
9 years agoCommunity Champion
powerbi_bi This should work :smileyhappy:
Flag Column =
IF (
CALCULATE (
DISTINCTCOUNT ( 'Table'[COUNTRY] ),
ALLEXCEPT ( 'Table', 'Table'[CASE_ID] )
)
= 1,
0,
1
)
MarkPalmberg
7 years agoKudo Commander
I have a similar question based on the same data. How does the calculation change if I want my flag column to indicate whether a case has a CHINA value? Do I need a filter value in the DISTINCTCOUNT function?
My use case is that I want to see all countries for cases that have a CHINA value. Thanks!