Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Hi, I have a dataset which has DATE, NAME, Hourbucket, Sales. I need to find out if sales was 0 for any hourbucket for a date and if true then check last year same date same hourbucket and same name to see if the sales was 0.
if both the conditions are true then "sales" else "NoSale".
Example
if Sale =0 then
check sales (Same column) a year before for the same name and hourbucket and that sales =0
then "NoSales"
else "Sales"
Any help will be appreciated.
This is the kind of dataset. Sorry the file is too big to get an exact sample
Name | hr bucket | Year | Month Name | Day | Sales |
Jon | 1 | 2016 | Nov | 12 | 0 |
Jon | 2 | 2016 | Nov | 12 | 560 |
Jon | 3 | 2016 | Nov | 12 | 647 |
Jon | 4 | 2016 | Nov | 12 | 914 |
Jon | 2 | 2016 | Nov | 13 | 996 |
Jon | 3 | 2016 | Nov | 13 | 982 |
Jon | 4 | 2016 | Nov | 13 | 664 |
Jon | 1 | 2016 | Nov | 13 | 777 |
Solved! Go to Solution.
@samHil , Try a A new column =
var _sales = sumx(filter(Table, [Name] =earlier([Name]) && [hr] =earlier([hr]) && [Month ] =earlier([Month]) && [Day] =earlier([Day])
&& [year] =earlier([year]) -1),[Sales])
return
if([sales]= 0 && (_sales+0) =0 , "NoSales" , "Sales")
@samHil , Try a A new column =
var _sales = sumx(filter(Table, [Name] =earlier([Name]) && [hr] =earlier([hr]) && [Month ] =earlier([Month]) && [Day] =earlier([Day])
&& [year] =earlier([year]) -1),[Sales])
return
if([sales]= 0 && (_sales+0) =0 , "NoSales" , "Sales")
User | Count |
---|---|
25 | |
21 | |
20 | |
13 | |
13 |
User | Count |
---|---|
40 | |
28 | |
28 | |
23 | |
21 |