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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
speedramps
Super User
Super User

How to create % of All using field parameters?

Power Bi have included a new “Field Parameters” feature in the May 2022 release.

I have created the following example, but you will need to enable the “Field Parameters” preview features to try it.

Click here to download my PBIX

 

It uses Field Parameters to allow a user to dynamically select a period (eg by  Year, Quarter or month) and the metric (e.g. sales  ordered or sales despatched).

 

I want to add [% or all] measure using Field Parameters. 

So when Quarter and Order items is selected then Q3-2020 = 25%  (8 / 32)  

but when Quarter and Despatch items is selected then Q3-2020 =  18.75%  (6 / 32)

 

Can you please fix the [% or all] measure using Field Parameters please ?
Only provide dynamic solutions using Field Parameters please. Thank you !

Click here to download my PBIX

 

% of all =

VAR valueforperiod = SUM(Metrics[Metric])

VAR valueforallperiods = CALCULATE(SUM(Metrics[Metric]), ALL('Calendar'))

RETURN

DIVIDE(valueforperiod,valueforallperiods)

 

speedramps_0-1653328811054.png

 

5 REPLIES 5
speedramps
Super User
Super User

Hi Community Support Team _ Eason

 

Thank you for the reply.

But there seems to have been a bit of misunderstanding.

I specifiaclly want to know if/how Field Parameteres can be included in measures.

Field Parameteres are a new preview feature in the May 2022.
Have you tried using  Field Parameteres yet?

I already knew how to use ALL to calculate % for individual measures,

but I am curious if we can include Field Parameteres in any measures.

I just gave % as an example, but the question is about Field Parameteres in measures and not % per se.

 

Has anyone tried to build an advance reports with Field Parameteres inside measures yet?

 

Thank you

Hi, @speedramps 

I'm afraid field Parameteres can‘t used for calculations. If you examine the generated code, you will see that it is essentially a parameter table that contains some values of type 'String'. Function ’SUM‘  cannot work with these string fields.

veasonfmsft_0-1653976882807.png

In my opinion, the field parameter is used to call the result of measure and the final result is still calculated in the corresponding measure.

 

Best Regards,
Community Support Team _ Eason

 

Thank you  v-easonf-msft

 

Yeap, I am aware that Field Parameter creates Calculated Table in the background.

The run query then creates the "code" which you can grab using Performance Analyser and paste it into Dax studio.

 

Field Parameters are a new preview feature in the May 2022 release, and I hopeful someone will fathom how to use them dynamical in measures. Alberto has published a good video about it.

 

Perhaps “ALL” was a bad example and has side tracked my issue.

I might close this ticket in a few days it we dont get back on track, and raise another ticket with more emphasis on “Field Parameter in Measures”. It would be a good feataure to have.

 

speedramps
Super User
Super User

Please can someone translate the suggestion and I will try it. Thank you.

Hi, @speedramps 

I am sorry for my mistake. My default browser caused it to be automatically translated when I publish.

You should modify measure 'Order items' and measure 'Despatch items' instead of field parameter table Metrics[Metric]. Also, there is no actual numerical data in Table 'Metrics' to apply the 'SUM' function.

Please modify your original formulas as follows:

 

Ordered items = 
VAR a =
    CALCULATE (
        COUNTROWS ( Facts ),
        USERELATIONSHIP ( 'Calendar'[Date], Facts[Order date] )
    )
VAR b =
    CALCULATE (
        COUNTROWS ( Facts ),
        ALL ( 'Calendar' ),
        USERELATIONSHIP ( 'Calendar'[Date], Facts[Order date] )
    )
RETURN
    a / b
Despatch items = 
VAR a =
    CALCULATE (
        COUNTROWS ( Facts ),
        USERELATIONSHIP ( 'Calendar'[Date], Facts[Depatched date] )
    )
VAR b =
    CALCULATE (
        COUNTROWS ( Facts ),
        ALL ( 'Calendar' ),
        USERELATIONSHIP ( 'Calendar'[Date], Facts[Depatched date] )
    )
RETURN
    a / b

 

veasonfmsft_0-1653875362813.png

 

veasonfmsft_1-1653875362815.png

For more details ,please  check my sample file.

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.