Murray Brown
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])
MTD =
VAR CURRENTYEAR = SELECTEDVALUE('CALENDAR'[YEAR])
VAR CURRENTMONTH = SELECTEDVALUE('CALENDAR'[Month])
RETURN CALCULATE([GROSS_PREMIUM],ALL('CALENDAR'),
'CALENDAR'[Month]= CURRENTMONTH &&
'CALENDAR'[Year] = CURRENTYEAR)
QTD 1 = CALCULATE(SUM('vPolicies'[Gross_Premium]),FILTER('CALENDAR','CALENDAR'[Quarter]=1))
QTD 2 = CALCULATE(SUM('vPolicies'[Gross_Premium]),FILTER('CALENDAR','CALENDAR'[Quarter]=2))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.