Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Rich_F
New Member

Using field parameter in a count() measure

Hi, 

 

I was wondering if anyone has a way of using a selectedvalue from a field parmeter within a count measure. So, using a measure/varible rather than a  column reference as an argument in the count(). Like the below:

Counts_for measure =
var parameter_selected= SELECTEDVALUE(Parameter[Parameter Fields])
var numerator  = CALCULATE(COUNT(parameter_selected))
return
numerator  
 
I have a long list of fields that thought i could put into a field parameter, and then create some measure ( percentages) that would be dynamic when the fields parameters are filtered. 
 
Any pointers appreciated, 

Thanks,

Rich
 
2 REPLIES 2
nhniniras
Frequent Visitor

Hi, 
I have the same problem and have solved it with a Swithc function (but I guess there should be a more simple solution)

SWITCH (
SELECTEDVALUE ( Parameter[Parameter Fields] ),
"'DimOrganisation'[BU]", DISTINCTCOUNT(DimOrganisation[BU]),
"'DimOrganisation'[Company]", DISTINCTCOUNT(DimOrganisation[Company]),
..........

It would be really nice if the Parameter fields could be used "directly" in a measure.
Just to be currious, have you found a better way to do it?

Regards Niels

daXtreme
Solution Sage
Solution Sage

Not getting replies? Well, it's time to read this: How to Get Your Question Answered Quickly - Microsoft Power BI Community

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors