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 Power BI Experts,
I am currently using below formula to count the row in table visual which is working fine. However, I want to use filed parameter to select columns dynamically in table visual could you help me how can I transform below formula. Result should display the rowcount no metter what combination user select in field parameter slicer.
Table 1:
Column 1 | Column 2 | Column 3 | Column 4 (used for measure) |
Measure 1 = Sum(Column 4)
Formula to calculate rowcount:
COUNTROWS(GROUPBY(Table 1, Table 1 [Column 1], Table 1 [Column 2], Table 1 [Column 3], "Name", sumx(currentgroup(), Table 1 [Measure 1])))
Thanks in advance.
@hi5jimmy Try if this measure works for you:
RowCountMeasure =
VAR SelectedColumns =
VALUES('FieldParameterSlicer'[SelectedColumn])
VAR GroupedTable =
SUMMARIZE(
'Table 1',
SelectedColumns,
"RowCount", COUNTROWS('Table 1')
)
RETURN
COUNTROWS(GroupedTable)
If you find this insightful, please provide a Kudo and accept this as a solution.
Hi @devesh_gupta ,
This is resulting in total rowcount of table as below step gives all columns not selected ones.
VALUES('FieldParameterSlicer'[SelectedColumn])
Hi @devesh_gupta ,
Thanks for your inputs. however, Summarize function is not allowing me to use parameters in second argument. It says Summarize function expects a column name as argument number 2.
@hi5jimmy Okay, let's try like this:
RowCountMeasure =
VAR SelectedColumns =
VALUES('FieldParameterSlicer'[SelectedColumn])
VAR GroupedTable =
CALCULATETABLE(
'Table 1',
'FieldParameterSlicer',
'FieldParameterSlicer'[SelectedColumn] IN SelectedColumns
)
RETURN
COUNTROWS(GroupedTable)
If you find this insightful, please provide a Kudo and accept this as a solution.
Hi Devesh
Getting error !!
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 |
---|---|
105 | |
101 | |
79 | |
73 | |
65 |
User | Count |
---|---|
141 | |
107 | |
100 | |
82 | |
74 |