Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I have created three independent columns
What I'd like to do is to select a column and get the number of items. For exmple if I select Col1, I get 3 but selecting COL3 would get 6.
May be using a measure and drop it in a card...
Many thanks in advance.
Solved! Go to Solution.
HI @SBePicas,
I'd like to suggest you create a new table with three field names and use it as source of slicer.
NewTable =
DATATABLE ( "ColName", STRING, { { "Col1" }, { "Col2" }, { "Col3" } } )
After these steps, you can create a measure formula with switch function to check current selected value and redirect to different calculation expressions.
DC based on selection =
VAR selected =
SELECTEDVALUE ( NewTable[ColName] )
RETURN
SWITCH (
selected,
"Col1", COUNTROWS ( VALUES ( Table1[Col1] ) ),
"Col2", COUNTROWS ( VALUES ( Table1[Col2] ) ),
"Col3", COUNTROWS ( VALUES ( Table1[Col3] ) ),
COUNTROWS ( VALUES ( Table1[Col1] ) )
)
Regards,
Xiaoxin Sheng
hi @SBePicas ,
What do you mean by "independent"?
Are they from the same table? If they are from different tables, are the tables related?
Sorry, still learning the proper terminology.
I have one table with 3 columns. Each field (column) is dragged into the report editor and thus I have three visuals in the report editor.
HI @SBePicas,
I'd like to suggest you create a new table with three field names and use it as source of slicer.
NewTable =
DATATABLE ( "ColName", STRING, { { "Col1" }, { "Col2" }, { "Col3" } } )
After these steps, you can create a measure formula with switch function to check current selected value and redirect to different calculation expressions.
DC based on selection =
VAR selected =
SELECTEDVALUE ( NewTable[ColName] )
RETURN
SWITCH (
selected,
"Col1", COUNTROWS ( VALUES ( Table1[Col1] ) ),
"Col2", COUNTROWS ( VALUES ( Table1[Col2] ) ),
"Col3", COUNTROWS ( VALUES ( Table1[Col3] ) ),
COUNTROWS ( VALUES ( Table1[Col1] ) )
)
Regards,
Xiaoxin Sheng
Distinct count =
VAR _val1 = VALUES(Tablename[Col1])
VAR _val2 = VALUES(Tablename[Col2])
VAR _val3 = VALUES(Tablename[Col3])
VAR _union = DISTINCT(UNION(_val1,_val2, _val3))
RETURN COUNTROWS(_union)
Try this!
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 52 | |
| 45 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 108 | |
| 106 | |
| 39 | |
| 33 | |
| 25 |