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:
DISTINCTCOUNT() requires you to specify a column or group of columns (you can also use VALUES() for that same goal).
When you have two orange values in the Sales Code column (for example) then the resulting DISTiNCTCOUNT() will be 1, not 2. Maybe you want the COUNTROWS() for each color?
thanks for your reply. Can you please help me how can I apply both function in measue? Can you please advise and attach your working file as well.
I am trying to count each columns here. Each column contiain two status which is red and green. I am trying get the count according to the color code against the columns based on the visual data,,,,Fruist list, Area code,Lanuage and sales code.