cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hamdan1234
Helper II
Helper II

Dax Count function with sum

I am stuck into this I had this table to which I converted to 2nd table below.

UserDateHours Spent
Arun Gopinath Prabhu27/07/20212.5
Fahad Rauf Shaikh28/07/20213.6
Vikrant Sanjay Tamboli27/07/20211.4
Vikrant Sanjay Tamboli28/07/20211.1
Arun Gopinath Prabhu28/07/20213.1
Rajtarangini28/07/20211.8
Swati Singh27/07/20212.3
Utkarsha Sharma28/07/20214.5
Utkarsha Sharma27/07/20211
Shubham A Tembhurnikar27/07/20211.4
Shubham A Tembhurnikar28/07/20211.1
Rajtarangini27/07/20213.1
Swati Singh28/07/20210.4
Fahad Rauf Shaikh27/07/20212.2

I converted above table to the table below.

UsersBaseline HoursTotal Hours
Arun Gopinath Prabhu55.6
Fahad Rauf Shaikh55.8
Vikrant Sanjay Tamboli52.5
Rajtarangini54.9
Swati Singh52.7
Utkarsha Sharma55.5
Shubham A Tembhurnikar52.5

I summed up the hours duration to respective user but now I want to count the number of user based on total hours above 5 so my outcome should be below table showing the count of over achiever which exceeds baseline of 5 hours. 

UsersBaseline HoursTotal HoursDesired Outcome Count
Arun Gopinath Prabhu55.61
Fahad Rauf Shaikh55.81
Vikrant Sanjay Tamboli52.50
Rajtarangini54.90
Swati Singh52.70
Utkarsha Sharma55.51
Shubham A Tembhurnikar52.50

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Hamdan1234 , Assuming Total Hours is a measure. Try a measure like

 

Countx( filter(Values(Table[Users]), [Total Hours] >5), [USers])

 

or

 

sumx( Values(Table[Users]),if( [Total Hours] >5, 1, 0))

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

View solution in original post

4 REPLIES 4
manikumar34
Solution Sage
Solution Sage

@Hamdan1234 
The below query helps you to make a column with the result.
If(Table[HoursTotal]>5,1,0)





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




VahidDM
Community Champion
Community Champion

Hi @Hamdan1234 

You can add your desired column to the converted table with this code:

If(table[Total Hours ]>5,1,0)

 

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

Appreciate your Kudos✌️!!



 

amitchandak
Super User
Super User

@Hamdan1234 , Assuming Total Hours is a measure. Try a measure like

 

Countx( filter(Values(Table[Users]), [Total Hours] >5), [USers])

 

or

 

sumx( Values(Table[Users]),if( [Total Hours] >5, 1, 0))

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

View solution in original post

Instead of putting fixed number like 5  can we use a measure to make it dynamic?How can we do it like how to create it ?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.