Forum Discussion
How to calculate % based on row count from 2 tables
- 4 years ago
Hi @
You may try this solution.
1 Create a Calculated Table
Table = SELECTCOLUMNS( {"Total Count Null + Not Null","Null%","Not Null %"},"details",[Value])2 Create a Measure
Count&Percent = VAR numTable1 = COUNTROWS ( 'Table 1' ) VAR numTable2 = COUNTROWS ( 'Table 2' ) RETURN SWITCH ( MAX ( 'Table'[details] ), "Total Count Null + Not Null", numTable1 + numTable2, "Null%", numTable1 / ( numTable1 + numTable2 ), "Not Null %", numTable2 / ( numTable1 + numTable2 ) )Then, build a Table visual like this.
Also, attached the pbix file as reference.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Hi @
You may try this solution.
1 Create a Calculated Table
Table = SELECTCOLUMNS( {"Total Count Null + Not Null","Null%","Not Null %"},"details",[Value])
2 Create a Measure
Count&Percent =
VAR numTable1 =
COUNTROWS ( 'Table 1' )
VAR numTable2 =
COUNTROWS ( 'Table 2' )
RETURN
SWITCH (
MAX ( 'Table'[details] ),
"Total Count Null + Not Null", numTable1 + numTable2,
"Null%",
numTable1 / ( numTable1 + numTable2 ),
"Not Null %",
numTable2 / ( numTable1 + numTable2 )
)
Then, build a Table visual like this.
Also, attached the pbix file as reference.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun