Forum Discussion

Reshma_Doshi's avatar
Reshma_Doshi
Regular Visitor
3 years ago
Solved

Need help with Dax

I have data as shown in the Image - which time spent in seconds on an App on various days. 

All columns are defined below. 

 

Col F is derived using Col B and Col E is derived using Col C. Values are repeated on each row in my dataset as data pertains to one user per day. 

 

I need to create a measure using dax where I can display "Sum of total time spent on this app per user" in minutes.   

Which is 234.25 seconds (6.17 +33.75+194.33 from Col G) / 3 users (Based on Unique count in Col A) / 60 (To convert into minutes).  

 

Looking forward to guidance. 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Reshma_Doshi 

    You can create a measure as follows

    Measure = var a=SUMMARIZE(ALLSELECTED('Table'),[User id],[Month],[Distinct Date Count],[Sum of Duration in Secs],"Divide",DIVIDE([Sum of Duration in Secs],[Distinct Date Count])/CALCULATE(DISTINCTCOUNT('Table'[User id]),ALLSELECTED('Table')))
    return SUMX(FILTER(a,[User id] in VALUES('Table'[User id])&&[Month] in VALUES('Table'[Month])),[Divide])/60

    Output

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Reshma_Doshi 

    You can create a measure as follows

    Measure = var a=SUMMARIZE(ALLSELECTED('Table'),[User id],[Month],[Distinct Date Count],[Sum of Duration in Secs],"Divide",DIVIDE([Sum of Duration in Secs],[Distinct Date Count])/CALCULATE(DISTINCTCOUNT('Table'[User id]),ALLSELECTED('Table')))
    return SUMX(FILTER(a,[User id] in VALUES('Table'[User id])&&[Month] in VALUES('Table'[Month])),[Divide])/60

    Output

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.