Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
UlaDeil
New Member

DAX calculate

Message: Hi I Need help in the data file Im working with. I cant figure out how I can calculate  orders that completed before and after the set time(completebefore) and (completeafter).

 

 

the table below is my expected output. just need what DAX expression should I use to calculate the early orders and late orders. 

if I  were to put it in simple words if completiontime is < complete beforetime = early order if > complete after then late order. 

 

UlaDeil_0-1678062054795.jpeg

 

here's the sample data

shortIdDrivercompleteBeforeTimecompleteAfterTimecreationTimestartTimecompletionTime
250563Andy Abreu1/10/2023 18:001/10/2023 15:001/9/2023 21:001/10/2023 15:371/10/2023 15:43
6219968Joseph Lokoyi12/20/2022 15:3012/20/2022 11:0012/20/2022 7:3312/20/2022 10:1912/20/2022 10:21
10564100Joseph Lokoyi1/24/2023 18:001/24/2023 15:001/23/2023 21:001/24/2023 15:111/24/2023 15:36
11466434Samson Lawani12/21/2022 16:3012/21/2022 11:0012/21/2022 8:0412/21/2022 18:4712/21/2022 18:48
18317730Andy Abreu1/10/2023 18:001/10/2023 15:001/9/2023 21:001/10/2023 15:061/10/2023 15:34
28653289Andy Abreu1/12/2023 18:001/12/2023 15:001/11/2023 21:001/12/2023 17:081/12/2023 17:09
45183630Andy Castilo1/5/2023 19:001/5/2023 16:001/4/2023 21:001/5/2023 18:031/5/2023 18:10
83912333Andy Castilo1/3/2023 16:001/3/2023 11:001/3/2023 6:571/3/2023 12:031/3/2023 12:26
89153174Andy Castilo1/3/2023 16:001/3/2023 11:001/3/2023 6:571/3/2023 11:031/3/2023 12:03
5.17E+37Joseph Lokoyi12/20/2022 15:3012/20/2022 11:0012/20/2022 7:3312/20/2022 10:2112/20/2022 10:21
6.79E+82Ogu Osias12/20/2022 14:3012/20/2022 11:0012/20/2022 7:3312/20/2022 14:2612/20/2022 14:45
3.90E+97Andy Castilo1/10/2023 18:001/10/2023 15:001/9/2023 21:001/10/2023 17:091/10/2023 17:54
00719decAndy Abreu1/10/2023 19:001/10/2023 16:001/9/2023 21:001/10/2023 17:371/10/2023 17:37
008b9e85Andy Castilo1/8/2023 19:001/8/2023 16:001/7/2023 21:001/8/2023 19:291/8/2023 19:39
009b6ee1Andy Castilo1/8/2023 19:001/8/2023 16:001/7/2023 21:001/8/2023 18:461/8/2023 18:52
00dc7eb3David Mercado1/4/2023 16:001/4/2023 9:001/4/2023 7:231/4/2023 12:291/4/2023 13:13
010783c9Samson Lawani12/22/2022 19:0012/22/2022 16:0012/21/2022 21:0012/22/2022 18:5012/22/2022 19:23
01eedb2fOgu Osias12/22/2022 18:0012/22/2022 11:0012/22/2022 9:4012/22/2022 11:1312/22/2022 11:13
023464caSamson Lawani12/21/2022 16:3012/21/2022 11:0012/21/2022 8:0412/21/2022 10:5912/21/2022 10:59
0434c392Andy Castilo1/8/2023 19:001/8/2023 16:001/7/2023 21:001/8/2023 19:131/8/2023 19:13
0490866dAndy Castilo1/24/2023 10:151/24/2023 7:001/23/2023 21:001/24/2023 8:571/24/2023 9:29
3 REPLIES 3
UlaDeil
New Member

 

the table below is my expected output. just need what DAX expression should I use to calculate the early orders and late orders. 

if I  were to put it in simple words if completiontime is < complete beforetime = early order if > complete after then late order. 

 

FINAL OUTPUT.jpg

here's the sample data

shortIdDrivercompleteBeforeTimecompleteAfterTimecreationTimestartTimecompletionTime
250563Andy Abreu1/10/2023 18:001/10/2023 15:001/9/2023 21:001/10/2023 15:371/10/2023 15:43
6219968Joseph Lokoyi12/20/2022 15:3012/20/2022 11:0012/20/2022 7:3312/20/2022 10:1912/20/2022 10:21
10564100Joseph Lokoyi1/24/2023 18:001/24/2023 15:001/23/2023 21:001/24/2023 15:111/24/2023 15:36
11466434Samson Lawani12/21/2022 16:3012/21/2022 11:0012/21/2022 8:0412/21/2022 18:4712/21/2022 18:48
18317730Andy Abreu1/10/2023 18:001/10/2023 15:001/9/2023 21:001/10/2023 15:061/10/2023 15:34
28653289Andy Abreu1/12/2023 18:001/12/2023 15:001/11/2023 21:001/12/2023 17:081/12/2023 17:09
45183630Andy Castilo1/5/2023 19:001/5/2023 16:001/4/2023 21:001/5/2023 18:031/5/2023 18:10
83912333Andy Castilo1/3/2023 16:001/3/2023 11:001/3/2023 6:571/3/2023 12:031/3/2023 12:26
89153174Andy Castilo1/3/2023 16:001/3/2023 11:001/3/2023 6:571/3/2023 11:031/3/2023 12:03
5.17E+37Joseph Lokoyi12/20/2022 15:3012/20/2022 11:0012/20/2022 7:3312/20/2022 10:2112/20/2022 10:21
6.79E+82Ogu Osias12/20/2022 14:3012/20/2022 11:0012/20/2022 7:3312/20/2022 14:2612/20/2022 14:45
3.90E+97Andy Castilo1/10/2023 18:001/10/2023 15:001/9/2023 21:001/10/2023 17:091/10/2023 17:54
00719decAndy Abreu1/10/2023 19:001/10/2023 16:001/9/2023 21:001/10/2023 17:371/10/2023 17:37
008b9e85Andy Castilo1/8/2023 19:001/8/2023 16:001/7/2023 21:001/8/2023 19:291/8/2023 19:39
009b6ee1Andy Castilo1/8/2023 19:001/8/2023 16:001/7/2023 21:001/8/2023 18:461/8/2023 18:52
00dc7eb3David Mercado1/4/2023 16:001/4/2023 9:001/4/2023 7:231/4/2023 12:291/4/2023 13:13
010783c9Samson Lawani12/22/2022 19:0012/22/2022 16:0012/21/2022 21:0012/22/2022 18:5012/22/2022 19:23
01eedb2fOgu Osias12/22/2022 18:0012/22/2022 11:0012/22/2022 9:4012/22/2022 11:1312/22/2022 11:13
023464caSamson Lawani12/21/2022 16:3012/21/2022 11:0012/21/2022 8:0412/21/2022 10:5912/21/2022 10:59
0434c392Andy Castilo1/8/2023 19:001/8/2023 16:001/7/2023 21:001/8/2023 19:131/8/2023 19:13
0490866dAndy Castilo1/24/2023 10:151/24/2023 7:001/23/2023 21:001/24/2023 8:571/24/2023 9:29
Greg_Deckler
Super User
Super User

@UlaDeil Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
andhiii079845
Super User
Super User

Please share a example with the underlaying data. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.