Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

How to parameterize a DAX formula/measure

Hello,

I have two different Power BI dashboards that are identical except for one column in my database; one dashboard uses a column called v7 Twentile and the other dashboard uses a column called v6 Twentile.  These columns contain a number between [1 ... 20] and form the rows of a matrix visualization:

I've created five DAX formulas that look something like this:

sum_mailed_allrows_v7 = calculate([units_mailed], all('campaign_performance'[v7_twentile]))
where the context is defined to be the entire v7_twentile column of the table, campaign_performance.  The problem I'm trying to solve is that right now I have to create the exact same formulas for the v6 Twentile dashboard, so the formula, above, looks like this:
sum_mailed_allrows_v7 = calculate([units_mailed], all('campaign_performance'[v6_twentile]))
I would rather just have five DAX formulas rather than 10, but I don't know how to change the v7_twentile/v6_twentile into a parameter that can be set to be a different value on each dashboard. 
 
Other than that difference, the dashboards are identical.  I'm fairly new to Power BI and DAX so any specific instructions would be appreciated.

1 Reply

  • Hi Anonymous ,

     

    Is the database the same for all 10 dashboards? and you need to make the calculation based on different columns?

     

    I would unpivot those columns and then use a slicer or a filter within the measure to filter out the V7 or V6 value