Forum Discussion
Syndicate_Admin
4 years agoAdministrator
error in formula dax
good afternoon, I have a design
I capture the year and month of the slicer, I need to get a value for the same period of a year before, for which I make the following formula
mes_ant = DATEADD(Hoja1[my],-1,YEAR)
where I subtract a year to the selected value, until there well because I get the following values
now I need to add the value of the column for that month I use this
total_mes_ant = calculate(SUM(Hoja1[Value]),FILTER(Hoja1,Hoja1[my]=[mes_ant]))
but with that formula it generates emptiness
but in the table if there data
what can be my mistake?
9 Replies
- lbendlinSuper User
- show your data model
- consider using SAMEPERIODLASTYEAR()
- Syndicate_AdminAdministrator
I currently only have one table as shown in the image
what I want is from selecting a month
get the value of the value column for a previous year and the previous month
- lbendlinSuper User
You need to modify the filter context to include the full table, by using ALL() or similar.
- Syndicate_AdminAdministrator
hello, what a pity it is not very clear to me how to do it, you help me on the formula as serious that pity
total_mes_ant = calculate(SUM(Hoja1[Value]),FILTER(Hoja1,Hoja1[my]=[mes_ant]))