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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
L_G
Helper I
Helper I

Field Parameter dynamic measure

Goog morning to all,

 

I have a matrix with a field parameter in rows and revenues in values.

I need to have a measure that calculate the "% on grand total" and the "cumulated %", based on the dimension selected in the fiel parameter.

L_G_2-1706692380177.png

 

Can anyone help me solfing the two DAX measures??

 

Thanks in advance,

Luca

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @L_G ,

Please create 2 measures like:

% on grand total = DIVIDE([Revenue],CALCULATE([Revenue],ALLEXCEPT('Table','Table'[Year])))
cumulated % = 
VAR _all_year = CALCULATE([Revenue],ALLEXCEPT('Table','Table'[Year]))
VAR _select_paramerter = MAX('Parameter'[Parameter])
VAR _country = CALCULATE([Revenue],'Table'[Country]<=MAX('Table'[Country]))
VAR _product = CALCULATE([Revenue],'Table'[Product]<=MAX('Table'[Product]))
VAR _month = CALCULATE([Revenue],'Table'[Month Number]<=MAX('Table'[Month Number]))
VAR _result =
SWITCH(
    _select_paramerter,
    "Country",DIVIDE(_country,_all_year),
    "Product",DIVIDE(_product,_all_year),
    "Month Number",DIVIDE(_month,_all_year)
)
RETURN
_result

Output:

vcgaomsft_0-1706773969395.png

Please check the pbix file.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @L_G ,

Please create 2 measures like:

% on grand total = DIVIDE([Revenue],CALCULATE([Revenue],ALLEXCEPT('Table','Table'[Year])))
cumulated % = 
VAR _all_year = CALCULATE([Revenue],ALLEXCEPT('Table','Table'[Year]))
VAR _select_paramerter = MAX('Parameter'[Parameter])
VAR _country = CALCULATE([Revenue],'Table'[Country]<=MAX('Table'[Country]))
VAR _product = CALCULATE([Revenue],'Table'[Product]<=MAX('Table'[Product]))
VAR _month = CALCULATE([Revenue],'Table'[Month Number]<=MAX('Table'[Month Number]))
VAR _result =
SWITCH(
    _select_paramerter,
    "Country",DIVIDE(_country,_all_year),
    "Product",DIVIDE(_product,_all_year),
    "Month Number",DIVIDE(_month,_all_year)
)
RETURN
_result

Output:

vcgaomsft_0-1706773969395.png

Please check the pbix file.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

It works perfectly, thank you so much !!! 

@Anonymous 

PijushRoy
Super User
Super User

Hi @L_G 

Can you please check below two DAX

 

% On Grand Total := 
DIVIDE(
  SUM('Table'[SaleValue]),
  CALCULATE(
    SUM('Table'[SaleValue]),
    ALL('Table') 
  )
)

 

 

 

Cumulated % Of Grand Total :=
DIVIDE(
  CALCULATE(
    SUM('Table'[SaleValue]),
    FILTER(
      ALL('Table'),
      'Table'[Product] <= EARLIER('Table'[Product])
    )
  ),
  CALCULATE(
    SUM('Table'[SaleValue]),
    ALL('Table') 
  )
)

 

 


If your requirement is solved, please make sure to MARK AS SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.

Thanks




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.