Forum Discussion
compare sales offices
hi, I write you to ask you a help.
I must compare the sales of the offices for year, but I have a problem when an office doesn't result to have sales in one year.
I have a field id, year and office example 2017office1 2018office1....
id idprec
2017office1 2016office1
2018office1 2017office1
through the formula calculate (sum (sales); filter (TAB1;ID=EARLIER (IDPREC))
if an office doesn't have sales for the year 2018 it doesn't suit me to look for the possible value of the year before and
therefore it doesn't notice the difference
help me!
4 Replies
- AnonymousNot applicable
romeo95,
Please check if the following DAX return your expected result, if not, please describe more about your desired result.previousyearsales = CALCULATE(FIRSTNONBLANK(TAB1[sales],1),FILTER(TAB1,TAB1[id]=EARLIER(TAB1[id])&&TAB1[year]=EARLIER(TAB1[year])-1))
diff = IF(ISBLANK(TAB1[sales])||ISBLANK(TAB1[previousyearsales]),BLANK(),TAB1[sales]-TAB1[previousyearsales])
Regards,
Lydia- romeo95Frequent Visitor
thank you, I'll try it soon as possible
- romeo95Frequent Visitor
Hi,
it doesn't work
The problem is this
id sales
201701/office1 100
201702/office1 55
201801/office1 75
2017 2018
year year-1 year year-1
month
office1 1 100 75 100
2 55
total 155 75 100There aren't sales for 201802 and the total year-1 of 2018 doesn't calculate it
Now I try to insert the no match record with 0 as sales