Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Power BI Use a Variable in Measures

In Power BI I am creating the following measures around a field called Gross_Premium. I have to then do the same for a number of other columns, which will involve a lot of work. Is there a way to make this easier by say using a variable in MTD, QTD1 etc that allow me to pass in Gross_Premium or any of the other columns to get a result. I am not sure if this even possible.


GROSS_PREMIUM = SUMX('vPolicies','vPolicies'[Gross_Premium])

Open in new window


MTD = 
VAR CURRENTYEAR = SELECTEDVALUE('CALENDAR'[YEAR]) VAR CURRENTMONTH = SELECTEDVALUE('CALENDAR'[Month]) RETURN CALCULATE([GROSS_PREMIUM],ALL('CALENDAR'), 'CALENDAR'[Month]= CURRENTMONTH && 'CALENDAR'[Year] = CURRENTYEAR)

Open in new window

QTD 1 = CALCULATE(SUM('vPolicies'[Gross_Premium]),FILTER('CALENDAR','CALENDAR'[Quarter]=1))
QTD 2 = CALCULATE(SUM('vPolicies'[Gross_Premium]),FILTER('CALENDAR','CALENDAR'[Quarter]=2))

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Tom Farrar
Tom Farrar
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial