Forum Discussion
samnaw
6 years agoResolver I
Convert sting to integer Calculate
Hi I have a year column that I want to keep it as string. I am currently using this DAX that works perfectly well. CY_Family_Sales = CALCULATE ( SUM ( Table_1[Sales]), FILTER ( '...
- 6 years ago
Hi samnaw ,
We should use max function first, then use value function to convert it to whole number, please try the following measure:
LY_Family_Sales = VAR LY = VALUE ( MAX ( 'Table_1'[Fiscal_Year] ) ) - 1 RETURN CALCULATE ( SUM ( Table_1[Sales] ), 'Table_1'[Fiscal_Year] = "" & LY, 'Table_1'[loyalty_flag] = "CARD" )
Best regards,
v-lid-msft
6 years agoCommunity Support
Hi samnaw ,
We should use max function first, then use value function to convert it to whole number, please try the following measure:
LY_Family_Sales =
VAR LY =
VALUE ( MAX ( 'Table_1'[Fiscal_Year] ) ) - 1
RETURN
CALCULATE (
SUM ( Table_1[Sales] ),
'Table_1'[Fiscal_Year] = "" & LY,
'Table_1'[loyalty_flag] = "CARD"
)
Best regards,