Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Soof1234
Helper I
Helper I

Create table containing count of True/false of multiple columns

Hi,

 

I was looking for a similar topic, but couldn't automatically find it. I have like 6 columns with each column has either value true or false. I forgot how to do this as I did it before without unpivotting the columns. So I am looking for the solution without doing unpivot columns:

 

My Data:

Table is called 'Table'

 

Soof1234_0-1668595444206.png

 

 

My desired solution in a table without using unpivot:

 

 HasExchangeLicenseHasOneDriveLicenseHasSharePointLicenseHasSkypeForBusinessLicense
TRUE20806040
FALSE6002040

 

Thanks in advance

 

Kind Regards,

 

Soof1234

2 ACCEPTED SOLUTIONS
v-yadongf-msft
Community Support
Community Support

Hi  @Soof1234 , 

 

This is my test table (all columns are text type):

vyadongfmsft_3-1668680231371.png

 

Create a new table:

 

 

NewTable = DISTINCT('Table'[ColumnA])

 

 

vyadongfmsft_4-1668680266568.png

 

Create measures:

 

 

Count of ColA = COUNTX(FILTER(ALL('Table'),'Table'[ColumnA] = MAX('NewTable'[Type])),'Table'[ColumnA])

Count of ColB = COUNTX(FILTER(ALL('Table'),'Table'[ColumnB] = MAX('NewTable'[Type])),'Table'[ColumnB])

Count of ColC = COUNTX(FILTER(ALL('Table'),'Table'[ColumnC] = MAX('NewTable'[Type])),'Table'[ColumnC])

Count of ColD = COUNTX(FILTER(ALL('Table'),'Table'[ColumnD] = MAX('NewTable'[Type])),'Table'[ColumnD])

 

 

 

Create a matrix visual and you will get the result you want:

vyadongfmsft_5-1668680357377.png

Please refer the pbix file.

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @Soof1234 ,

 

Now the total value is correct. Please refer the pbix file:

vyadongfmsft_0-1668734657365.png

Best regards,

Yadong Fang

View solution in original post

7 REPLIES 7
v-yadongf-msft
Community Support
Community Support

Hi  @Soof1234 , 

 

This is my test table (all columns are text type):

vyadongfmsft_3-1668680231371.png

 

Create a new table:

 

 

NewTable = DISTINCT('Table'[ColumnA])

 

 

vyadongfmsft_4-1668680266568.png

 

Create measures:

 

 

Count of ColA = COUNTX(FILTER(ALL('Table'),'Table'[ColumnA] = MAX('NewTable'[Type])),'Table'[ColumnA])

Count of ColB = COUNTX(FILTER(ALL('Table'),'Table'[ColumnB] = MAX('NewTable'[Type])),'Table'[ColumnB])

Count of ColC = COUNTX(FILTER(ALL('Table'),'Table'[ColumnC] = MAX('NewTable'[Type])),'Table'[ColumnC])

Count of ColD = COUNTX(FILTER(ALL('Table'),'Table'[ColumnD] = MAX('NewTable'[Type])),'Table'[ColumnD])

 

 

 

Create a matrix visual and you will get the result you want:

vyadongfmsft_5-1668680357377.png

Please refer the pbix file.

 

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yadongf-msft ,

 

Thanks a lot! This was the solution I was looking for. Small note, is it also possible to have the row 'Totals' correct as it has the same count as valuue "true".

 

Kind Regards,

 

Soof1234

Hi @Soof1234 ,

 

Now the total value is correct. Please refer the pbix file:

vyadongfmsft_0-1668734657365.png

Best regards,

Yadong Fang

Hello @v-yadongf-msft ,

 

Thank you for the solution and I am able to build the Matrix for the number of True/false fields to display all together. 

 

However, I have other fields from the same table and visualizations on the same report page. When I click on any other visualizations, this Matrix doesn't interact/filter anyway.  I checked in Edit Interactions section, it is all enabled.

 

mittalpatel130_0-1692120966168.png

 

 

Can you please suggest me any alternate DAX that works in this case?

 

Thank you.

@v-yadongf-msft Thanks again!

Soof1234
Helper I
Helper I

Hi @Jayee

 

Thanks this probably helps, but I only needed the table I desired as a table visual, not as a datatable. I also have a lot of other columns next to the 4 I put in the example which do not need to be unpivoted.

 

Kind Regards,

Soof1234

Jayee
Responsive Resident
Responsive Resident

Hi @Soof1234 ,

 

1.Add an index column transformation in Power Query

Jayee_0-1668598860244.png

 

2. Select Index column and click "Unpivot Other Columns" in PQ.

Jayee_1-1668598955108.png

 

3.Select Attribute column and click on Pivot Column in PQ.

Jayee_2-1668599024405.png

select the value and aggregate as shown and ok

 

Final Result:-

Jayee_3-1668599091754.png

 

 If this post helps, then please consider Accept it as the solution, Appreciate your Kudos!!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.