Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
hi,
I have created a field parameter with columns from a table
now I need to get the count of rows from the columns selected
ex.
if a, b and c are columns and are involved in field parameter creation
count of a = 12
count of b = 10
count of c = 15
summarizing count of a and b = 10
summarizing count of c and b = 14
summarizing count of a and c = 15
so if column a and b are selected, I should get the count as 10 and only column c is selected then I should get 15 and so on for others
thanks in advance
Solved! Go to Solution.
Hi @newbie9 ,
Below is my table:
The following DAX might work for you:
Selected Column Count =
var tmp1=FILTER(ALL('Table'),[a]<>BLANK()&&[b]<>BLANK())
var tmp2=FILTER(ALL('Table'),[a]<>BLANK()&&[c]<>BLANK())
var tmp3=FILTER(ALL('Table'),[c]<>BLANK()&&[b]<>BLANK())
var ab_count=COUNTROWS(tmp1)
var ac_count=COUNTROWS(tmp2)
var bc_count=COUNTROWS(tmp3)
var tmp4=SELECTCOLUMNS(Parameter,"PT",[Parameter])
var _str =CONCATENATEX(tmp4,[PT])
return
SWITCH(TRUE(),
_str = "a" , COUNT('Table'[a]),
_str = "b" , COUNT('Table'[b]),
_str = "c" , COUNT('Table'[c]),
_str = "ab" , CALCULATE(COUNTROWS('Table'),tmp1),
_str = "bc" , CALCULATE(COUNTROWS('Table'),tmp3),
_str = "ac" , CALCULATE(COUNTROWS('Table'),tmp2)
)
The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @newbie9 ,
Below is my table:
The following DAX might work for you:
Selected Column Count =
var tmp1=FILTER(ALL('Table'),[a]<>BLANK()&&[b]<>BLANK())
var tmp2=FILTER(ALL('Table'),[a]<>BLANK()&&[c]<>BLANK())
var tmp3=FILTER(ALL('Table'),[c]<>BLANK()&&[b]<>BLANK())
var ab_count=COUNTROWS(tmp1)
var ac_count=COUNTROWS(tmp2)
var bc_count=COUNTROWS(tmp3)
var tmp4=SELECTCOLUMNS(Parameter,"PT",[Parameter])
var _str =CONCATENATEX(tmp4,[PT])
return
SWITCH(TRUE(),
_str = "a" , COUNT('Table'[a]),
_str = "b" , COUNT('Table'[b]),
_str = "c" , COUNT('Table'[c]),
_str = "ab" , CALCULATE(COUNTROWS('Table'),tmp1),
_str = "bc" , CALCULATE(COUNTROWS('Table'),tmp3),
_str = "ac" , CALCULATE(COUNTROWS('Table'),tmp2)
)
The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @newbie9
Please share sample data or sample pbix file link with expected result to get answer quickly
https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
Proud to be a Super User! | |
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
73 | |
72 | |
37 | |
31 | |
26 |
User | Count |
---|---|
95 | |
50 | |
43 | |
40 | |
35 |