Forum Discussion
DISTINCTCOUNT Measure in visualization
- 5 years ago
Hi Saxon10 ,
What you can do is to do a summarization with the calculation of the colours. For this what I have done is to create two other tables (in order to have the dynamic part of the filtering if you need).
Colour
Orange Green Formatting_Measure ID
Fruit List 1 Area Code 2 Language 3 Sales Code 4 Now add the following measure:
Count of Formats = VAR MEASURE_SELECTION = SWITCH ( SELECTEDVALUE ( Formatting[ID] ); 1; COUNTROWS ( FILTER ( SUMMARIZE ( ALLSELECTED ( REPORT[ITEM] ); REPORT[ITEM]; "Format"; [FORMATTING FRUITLIST] ); [Format] = MAX ( Colours[Colour] ) ) ); 2; COUNTROWS ( FILTER ( SUMMARIZE ( ALLSELECTED ( REPORT[ITEM] ); REPORT[ITEM]; "Format"; [FORMATTING AREACODE] ); [Format] = MAX ( Colours[Colour] ) ) ); 3; COUNTROWS ( FILTER ( SUMMARIZE ( ALLSELECTED ( REPORT[ITEM] ); REPORT[ITEM]; "Format"; [FORMATTING LANGUAGE] ); [Format] = MAX ( Colours[Colour] ) ) ); 4; COUNTROWS ( FILTER ( SUMMARIZE ( ALLSELECTED ( REPORT[ITEM] ); REPORT[ITEM]; "Format"; [FORMATTING SALESCODE] ); [Format] = MAX ( Colours[Colour] ) ) ) ) RETURN MEASURE_SELECTIONSee result below and in attach PBIX file:
Power BI works better with a data model rather than with unconnected tables. Try it out.
- Saxon105 years agoPost Prodigy
Hi,
Thanks for your reply. Unable to open the attachment. Can you please check at your end.
- MFelix5 years agoSuper User
Hi Saxon10 ,
What you can do is to do a summarization with the calculation of the colours. For this what I have done is to create two other tables (in order to have the dynamic part of the filtering if you need).
Colour
Orange Green Formatting_Measure ID
Fruit List 1 Area Code 2 Language 3 Sales Code 4 Now add the following measure:
Count of Formats = VAR MEASURE_SELECTION = SWITCH ( SELECTEDVALUE ( Formatting[ID] ); 1; COUNTROWS ( FILTER ( SUMMARIZE ( ALLSELECTED ( REPORT[ITEM] ); REPORT[ITEM]; "Format"; [FORMATTING FRUITLIST] ); [Format] = MAX ( Colours[Colour] ) ) ); 2; COUNTROWS ( FILTER ( SUMMARIZE ( ALLSELECTED ( REPORT[ITEM] ); REPORT[ITEM]; "Format"; [FORMATTING AREACODE] ); [Format] = MAX ( Colours[Colour] ) ) ); 3; COUNTROWS ( FILTER ( SUMMARIZE ( ALLSELECTED ( REPORT[ITEM] ); REPORT[ITEM]; "Format"; [FORMATTING LANGUAGE] ); [Format] = MAX ( Colours[Colour] ) ) ); 4; COUNTROWS ( FILTER ( SUMMARIZE ( ALLSELECTED ( REPORT[ITEM] ); REPORT[ITEM]; "Format"; [FORMATTING SALESCODE] ); [Format] = MAX ( Colours[Colour] ) ) ) ) RETURN MEASURE_SELECTIONSee result below and in attach PBIX file:
- Saxon105 years agoPost Prodigy
Thank you so much for your time and help. Your solution was amazing. This is exactly I am looking for it.