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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Rigoleto
Helper II
Helper II

Stand alone Formulas

Hi, Since my skills about Power BI are in progress I have a lot of questions, currently I am writting a report that use a lot of business rules and there are some formulas(business rules) that need to be build, for instance: I have a datetime 20180615 10:13:00, do I need to do is to set up the date time to 20180615 07:00:00 and calculate the lapsed time between both datetimes, in this case the lapsed time will be 3:13 hours, well, I am wondering if I can create a Formula and add this formula during the calculation of a column, you can notice that this value will be like a constante, take the daily day and calculate the lapsed time.

 

 

Rigoleto

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

Hi @Rigoleto

Let me show you an example

create a calculated column

column =
CONCATENATE (
    CONCATENATE ( DATEDIFF ( [set up time], [datetime1], HOUR ), ":" ),
    MOD ( DATEDIFF ( [set up time], [datetime1], MINUTE ), 60 )
)

3.png

Or, you can create a measure

Measure =
CONCATENATE (
    CONCATENATE (
        DATEDIFF ( MAX ( [set up time] ), MAX ( [datetime1] ), HOUR ),
        ":"
    ),
    MOD ( DATEDIFF ( MAX ( [set up time] ), MAX ( [datetime1] ), MINUTE ), 60 )
)

4.png

 

Best Regards

Maggie

3.png

 

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Rigoleto

Let me show you an example

create a calculated column

column =
CONCATENATE (
    CONCATENATE ( DATEDIFF ( [set up time], [datetime1], HOUR ), ":" ),
    MOD ( DATEDIFF ( [set up time], [datetime1], MINUTE ), 60 )
)

3.png

Or, you can create a measure

Measure =
CONCATENATE (
    CONCATENATE (
        DATEDIFF ( MAX ( [set up time] ), MAX ( [datetime1] ), HOUR ),
        ":"
    ),
    MOD ( DATEDIFF ( MAX ( [set up time] ), MAX ( [datetime1] ), MINUTE ), 60 )
)

4.png

 

Best Regards

Maggie

3.png

 

Greg_Deckler
Community Champion
Community Champion

So, yes you could create a measure that does this calculation and then use this measure in other measures or column calculations.



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors