Forum Discussion
dax expressions
Is there a cleaner way to write this expressions?
YTD_Variance_Matrix = Calculate(TOTALYTD([MTD_Actuals_Matrix],V_FS_DIM_DATE[act_date])-TOTALYTD([MTD_Budget_Matrix],V_FS_DIM_DATE[act_date]),KPI_Finance_Matrix[Group]="Revenue")&
(Calculate(TOTALYTD([MTD_Budget_Matrix],V_FS_DIM_DATE[act_date])-TOTALYTD([MTD_Actuals_Matrix],V_FS_DIM_DATE[act_date]),KPI_Finance_Matrix[Group]="Operating Expenses"))
THe output is coming out as a text value, need to convert to a numeric, for formatting purposes
Well, first, use Alt-Enter so that you can end up with:
YTD_Variance_Matrix = CALCULATE ( TOTALYTD( [MTD_Actuals_Matrix], V_FS_DIM_DATE[act_date] ) - TOTALYTD( [MTD_Budget_Matrix], V_FS_DIM_DATE[act_date] ), KPI_Finance_Matrix[Group]="Revenue") & (CALCULATE( TOTALYTD( [MTD_Budget_Matrix], V_FS_DIM_DATE[act_date] ) - TOTALYTD( [MTD_Actuals_Matrix], V_FS_DIM_DATE[act_date] ), KPI_Finance_Matrix[Group]="Operating Expenses" ) )The "&" is what is causing the return as text because that is the concatenation operator.
- Anonymous7 years ago
I replaced the & with a + and it worked yeah!
3 Replies
- Greg_DecklerCommunity Champion
Well, first, use Alt-Enter so that you can end up with:
YTD_Variance_Matrix = CALCULATE ( TOTALYTD( [MTD_Actuals_Matrix], V_FS_DIM_DATE[act_date] ) - TOTALYTD( [MTD_Budget_Matrix], V_FS_DIM_DATE[act_date] ), KPI_Finance_Matrix[Group]="Revenue") & (CALCULATE( TOTALYTD( [MTD_Budget_Matrix], V_FS_DIM_DATE[act_date] ) - TOTALYTD( [MTD_Actuals_Matrix], V_FS_DIM_DATE[act_date] ), KPI_Finance_Matrix[Group]="Operating Expenses" ) )The "&" is what is causing the return as text because that is the concatenation operator.
- AnonymousNot applicable
THank you very much, but Is there an alternative to using the & to join the calculate expressions together?
- AnonymousNot applicable
I replaced the & with a + and it worked yeah!