Forum Discussion

Laur1987's avatar
Laur1987
Frequent Visitor
4 years ago
Solved

Get chart using DAX

I need to get a chart like from Excel. I need to count the minutes between "Leave Time" and "Join Time" but considering that "Join time in the 14:05 rowcontain count from 14:04, so "14:11" row contain count from "14:10, 14:09, 14:08, 14:07, 14:06, 14:05, 14:04" and so on. I don't know if I am explaning very well. Thanks! In conclusion I need to see the range of users online on a platform.

sturlawstamerj1 

  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi Laur1987 

    Thank you for the clarifications. Please refer to the sample file with the solution 

    https://we.tl/t-zzBE0gh6YV

    Count = 
    VAR CurrentJoinTime = MAX ( '81099122685_-_Attendee_Report'[Join Time] )
    RETURN
        CALCULATE ( 
            SUMX (
                '81099122685_-_Attendee_Report',
                VAR JoinTime = '81099122685_-_Attendee_Report'[Join Time]
                VAR LeaveTime = '81099122685_-_Attendee_Report'[Leave Time]
                RETURN
                    IF ( 
                        CurrentJoinTime >= JoinTime && CurrentJoinTime <= LeaveTime,
                        1,
                        0
                    )
            ), 
            REMOVEFILTERS( '81099122685_-_Attendee_Report' ),
            '81099122685_-_Attendee_Report'[Join Time] <= CurrentJoinTime
        )

  • Many thanks! You saved me! 😄 Can you tell how I can do to shrink time in chart? In this moment I see at half hour. I want to see at 5-10 minute the chart.  tamerj1 

9 Replies