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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Group By with where clause in DAX

Hi Team.

I am new to powerbi. I need your help. I have a below table. In this table, I would like to get the time difference between

ARGO( component)  STARTED( status) and FTS( component)  ENDED ( status) for all distinct tracking IDs( group by).

 

Screenshot 1944-11-04 at 2.42.40 PM.png

 

Thanks

Vibhu

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a measure.

 

Jihwan_Kim_0-1674552884599.png

 

 

Time diff measure: =
IF (
    HASONEVALUE ( Data[Tracking ID] ),
    CALCULATE (
        SUM ( Data[Time] ),
        Data[Component] = "FTS",
        Data[Status] = "ENDED"
    )
        - CALCULATE (
            SUM ( Data[Time] ),
            Data[Component] = "ARGO",
            Data[Status] = "STARTED"
        )
)

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5
grazitti_sapna
Super User
Super User

Hey,

For solving this problem you can use create a new measure which will allow you to calculate the time difference between the two and get the desired output.

 

Time difference: =

IF (

    HASONEVALUE ( Data[tracking ID] ),

    CALCULATE (

        SUM ( Data[time] ),

        Data[component] = "FTS",

        Data[status] = "ENDED"

    )

        - CALCULATE (

            SUM ( Data[time] ),

            Data[component] = "ARGO",

            Data[status] = "STARTED"

        )

)

Anonymous
Not applicable

Thanks Jhiwan for your quick response.I need one more help how to get average of "Time diff measure" for all tracking id and show in card.?

Hi,

Thank you for your message.

Please check the below whether it shows what you expected.

 

Jihwan_Kim_0-1674655792205.png

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a measure.

 

Jihwan_Kim_0-1674552884599.png

 

 

Time diff measure: =
IF (
    HASONEVALUE ( Data[Tracking ID] ),
    CALCULATE (
        SUM ( Data[Time] ),
        Data[Component] = "FTS",
        Data[Status] = "ENDED"
    )
        - CALCULATE (
            SUM ( Data[Time] ),
            Data[Component] = "ARGO",
            Data[Status] = "STARTED"
        )
)

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hi @Jihwan_Kim  thanks for your response I have one more ques. if time is coming in epoch timestamp then i am getting the wrong result. can you please help me with this.?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors