Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I've been trying to solve an issue and I think I found a solution, however, I'm not sure it's the most efficient one.
I have a table where I have columns with True or False values.
TableA
ID | Column1 | Column2 | Column2 |
1 | TRUE | FALSE | TRUE |
2 | FALSE | FALSE | TRUE |
3 | TRUE | FALSE | TRUE |
4 | FALSE | TRUE | FALSE |
What I would like to do, is to have a vizualisations where I can check the total number of TRUE and FALSE for each column.
I though that it's possible to do it automatically in a vizualisation, however, it seems that it's not and I'm trying to solve this using DAX.
What I did was:
I created a new table.
I manually typed in True and False in the first column and then used DAX formula to populate the rest of the columns.
This is the result I got:
TableB
True_False | Column1 | Column2 | Column3 |
TRUE | 2 | 1 | 3 |
FALSE | 2 | 3 | 1 |
The formula I used to calculate the total number of TRUE or FALSE in table B:
Column1 =
CALCULATE(
COUNTROWS(
TableA),
FILTER(
TableA,
TableA[Column1] = TableB[True_False] )
)
I have two questions:
1) Is this the best way to do it?
2) Now I need to get for each column the percentage of TRUE values. What would be the best way to do it?
Thanks a lot!
In edit query
Change the column1,2,3 to a text data type
Click on the ID column > Transform > unpivot column > unpivot other column
Then add Dax measures
Total count = COUNTROWS('Table')
Total true = CALCULATE( [Total count], 'Table'[Value] = "TRUE" )
% = DIVIDE('Table'[Total true],'Table'[Total count])
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
37 | |
25 | |
19 | |
14 | |
8 |
User | Count |
---|---|
69 | |
48 | |
44 | |
19 | |
15 |