March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I need to set status to "0" for each store (calculated column preferred)if it satisfy the following conditions
The column in the data set are Date,Store,Time(6AM-8Pm one hour segment),Sales($) ,
Any help is appreciated.
on which line and do you have a sample file?
Hi @EV,
I think it is the last line If() condition am not sure though
The data file is very big. i have extracted a sample data.
Date | Hour | Sales | Store |
1/01/2020 0:00 | 6 | 47.1 | BB |
1/01/2020 0:00 | 7 | 40.9 | BB |
1/01/2020 0:00 | 8 | 309.05 | BB |
1/01/2020 0:00 | 9 | 285.6 | BB |
1/01/2020 0:00 | 10 | 518.4 | BB |
1/01/2020 0:00 | 11 | 725.45 | BB |
1/01/2020 0:00 | 12 | 485.8 | BB |
1/01/2020 0:00 | 13 | 463.2 | BB |
1/01/2020 0:00 | 14 | 399.65 | BB |
1/01/2020 0:00 | 15 | 342.85 | BB |
1/01/2020 0:00 | 16 | 218.3 | BB |
1/01/2020 0:00 | 17 | 1214.95 | BB |
2/01/2020 0:00 | 6 | 97.55 | BB |
2/01/2020 0:00 | 7 | 78.45 | BB |
2/01/2020 0:00 | 8 | 264.96 | BB |
2/01/2020 0:00 | 9 | 248.8 | BB |
2/01/2020 0:00 | 10 | 419.85 | BB |
2/01/2020 0:00 | 11 | 647.4 | BB |
2/01/2020 0:00 | 12 | 550.95 | BB |
2/01/2020 0:00 | 13 | 430.75 | BB |
2/01/2020 0:00 | 14 | 253.15 | BB |
2/01/2020 0:00 | 15 | 299.4 | BB |
2/01/2020 0:00 | 16 | 194.5 | BB |
2/01/2020 0:00 | 17 | 1148.5 | BB |
3/01/2020 0:00 | 6 | 75.4 | BB |
3/01/2020 0:00 | 7 | 115.65 | BB |
3/01/2020 0:00 | 8 | 218.1 | BB |
3/01/2020 0:00 | 9 | 338.1 | BB |
3/01/2020 0:00 | 10 | 365.25 | BB |
3/01/2020 0:00 | 11 | 625.2 | BB |
3/01/2020 0:00 | 12 | 924.65 | BB |
3/01/2020 0:00 | 13 | 530.54 | BB |
3/01/2020 0:00 | 14 | 354.95 | BB |
3/01/2020 0:00 | 15 | 266.05 | BB |
3/01/2020 0:00 | 16 | 218.75 | BB |
3/01/2020 0:00 | 17 | 1644.85 | BB |
4/01/2020 0:00 | 6 | 64.05 | BB |
4/01/2020 0:00 | 7 | 169.05 | BB |
4/01/2020 0:00 | 8 | 292.4 | BB |
4/01/2020 0:00 | 9 | 310.15 | BB |
4/01/2020 0:00 | 10 | 463.8 | BB |
4/01/2020 0:00 | 11 | 619.3 | BB |
4/01/2020 0:00 | 12 | 823.4 | BB |
4/01/2020 0:00 | 13 | 522.25 | BB |
4/01/2020 0:00 | 14 | 238.85 | BB |
4/01/2020 0:00 | 15 | 325.3 | BB |
Thank s in Advance,
I would be able to help lot faster with a sample file, try to creating a file with minimum data and share here
Hi @EV ,
I trierd that too then it gave the error "The expression refers to multiple columns. Multiple columns cannot be converted to scalar value"
Hi @samHil ,
Use the below dax:
Column=
Var a= CALCULATE(SUM(Sales))
Var b= CALCULATE(b, SAMEPERIODLASTYEAR(Date))
Var c= CALCULATE(a, FILTER( Table, Table(Time)= "6 am" || Table(Time)= "7 am"))
Var d= CALCULATE(c, SAMEPERIODLASTYEAR(Date))
Var e= CALCULATE(COUNTROWS(FILTER(Table, Table[Sales]= 0)), FILTER(Table, Table(Time)>= 9am || Table(Time)>= 3pm ))
Var f= CALCULATE(e, SAMEPERIODLASTYEAR(Date))
Return IF(AND(AND(AND(AND(AND(a= 0, b >0), c=0),d>0),e>2),f=0), 0, BLANK())
I hope this helps.
Kudos are always appreciated!
Thank you for the reply. I executed the code and got an error.
Var b= CALCULATE(b, SAMEPERIODLASTYEAR(Date)) The "b" inside the Calculate function is not valid.
I think we cannot declare the variable and use it at the same time.
Thank you,
SAM
yeah, it must have been a typo, since you are looking at sales last year , replace b with a
Var b= CALCULATE(a, SAMEPERIODLASTYEAR(Date))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
21 | |
16 | |
14 |