Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a large dataset with sales information aggregated by date, store#, and most imporantly by hour. See Below
Date _ StoreId _ Hour _ Online Orders _ Phone Orders _ Total Orders
Essentially - I'm trying to create a column flag of T/F to identify when a store has 3 consecutive hours of Online sales = 0 but Total Orders were > X.
=AND(SUMIFS(OnlineOrders,DATE,[@DATE],StoreId,[@StoreId],Hour,OR([@Hour],[@Hour]+1,[@Hour]-1)) = 0, SUMIFS(TotalOrders,DATE,[@DATE],StoreId,[@StoreId],Hour,OR([@Hour],[@Hour]+1,[@Hour]-1)) > X
Can someone please help?
Hi @BI_Noob ,
The same result export by this DAX expression:
Column =
VAR _f =
FILTER (
'Table',
[Date] = EARLIER ( 'Table'[Date] )
&& [StoreId] = EARLIER ( 'Table'[StoreId] )
&& [Hour]
>= EARLIER ( 'Table'[Hour] ) - 1
&& [Hour]
<= EARLIER ( 'Table'[Hour] ) + 1
)
RETURN
AND ( SUMX ( _f, [Online Orders] ) = 0, SUMX ( _f, [Phone Orders] ) > 0 )
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@BI_Noob , need a better sample. I think it same as Continuous streak : https://youtu.be/GdMcwvdwr0o
Hi Amit,
I watched the video and I'm not too sure if it's the same. Attached you'll find a sample dataset. Here's how I got the column to calc what I'm trying to accomplish
=AND(SUM(SUMIFS([Online Orders],[Date],[@Date],[StoreId],[@StoreId],[Hour],[@Hour]),SUMIFS([Online Orders],[Date],[@Date],[StoreId],[@StoreId],[Hour],[@Hour]+1),SUMIFS([Online Orders],[Date],[@Date],[StoreId],[@StoreId],[Hour],[@Hour]-1)) = 0,
SUM(SUMIFS([Phone Orders],[Date],[@Date],[StoreId],[@StoreId],[Hour],[@Hour]),SUMIFS([Phone Orders],[Date],[@Date],[StoreId],[@StoreId],[Hour],[@Hour]+1),SUMIFS([Phone Orders],[Date],[@Date],[StoreId],[@StoreId],[Hour],[@Hour]-1)) > 0)
Hi Amit,
Please see below;
Sorry copy and paste from excel causes an error so I had to create link to file. Let me know if this helps explain. I sincerely appreciate your help.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 90 | |
| 81 | |
| 66 | |
| 65 |