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
SantoshKumar
Employee
Employee

Hours Calculation result after excluding the Days

Hi,

 I need to Modify Hours Column in My table. 

Currently i have two Columns 1. Days 2. Hours as shown in the pic below.CalcHours.JPG

Hours value at present is Total Hours  but my requirement is to get Hours Value if and only if Days value is zero.

ex: if day value is 1, Hours value should be zero.

if day value is zero, then only hours value should populate by excluding the days.

 

thanks

santosh

 

 

 

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @SantoshKumar,

 

Here we can use MOD function to work on it.

 

Hours = IF(Table1[Days]=1,0,MOD(DATEDIFF(Table1[StartTime],Table1[EndTime],HOUR),24))

2.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @SantoshKumar,

 

Here we can use MOD function to work on it.

 

Hours = IF(Table1[Days]=1,0,MOD(DATEDIFF(Table1[StartTime],Table1[EndTime],HOUR),24))

2.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

@v-frfei-msftThanks. your query solves one of my issue.

Greg_Deckler
Super User
Super User

Try:

 

Hours = 
IF([Days]>0,0,DATEDIFF...)

So, just plug in your formula for the FALSE condition.


Follow on LinkedIn
@ 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...

Thanks @Greg_Deckler

 

i was able to get the details in sql when i providde my query as:  DateDiff(Hour,StartTrgTime,endTrgTime)%24

when it comes to PB_query  - i have below option 

DATEDIFF(BABugs[Days],BABugs[Hours],HOUR) and it results are zero but i need remainder as my result.
 could you help me on it. 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.