March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi everyone, would anyone be able to help with a DAX calculation for the following?
I have a table including Name of the Project (projects are recurring) and Amount of Hours as columns.
Now I would like to create a Measure that determines the number of projects that have more than 20 hours. I already have a Measure that determines the number of projects:
Anzahl Projekte 2022 = DISTINCTCOUNT(CATS_Buchungen[Auftragsname]).
How do I add the condition that only projects over 20 hours are Counted? I have tried so Mandy things, but nothing worked.
Thanks in advance!
Solved! Go to Solution.
Hi @Rth ,
You could try below code:-
m =
VAR _calc =
FILTER (
SUMMARIZE (
'Table (5)',
'Table (5)'[Name of Project],
"_SUM", SUM ( 'Table (5)'[Column1] )
),
[_SUM] >= 20
)
RETURN
COUNTROWS ( _calc )
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @Rth
Are you getting your problems solved ? If it has been solved, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Rth ,
You could try below code:-
m =
VAR _calc =
FILTER (
SUMMARIZE (
'Table (5)',
'Table (5)'[Name of Project],
"_SUM", SUM ( 'Table (5)'[Column1] )
),
[_SUM] >= 20
)
RETURN
COUNTROWS ( _calc )
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi,
thanks for your response.
I think I did not express myself well enough. I attachted an example:
The table's name is "Table".
Regarding your code:
I used DISTINCTCOUNT instead of COUNTROWS because I would like to count the distinct number of projects. But the code still did not work..
Aha, then try this
Project20Plus =
CALCULATE(
COUNTROWS( DISTINCT(CATS_Buchungen[Project])
),
FILTER(
ALL(CATS_Buchungen),
CATS_Buchungen[HoursColumn]>20
)
)
Hi,
The solution of @Samarth_18 works fine and you don't need to do a distinct count, since because of summarize, your project we'll be only one time with the total time of each project.
If i take the same formula as he proposed :
Count of Project with more than 20h =
VAR TableTemp = FILTER(
SUMMARIZECOLUMNS( 'Table Name'[ID Project] , "Tot Hours Project" , SUM( 'Table Name'[Time spent column] ) ) ,
[Tot Hours Project] > 20 ) //This is the filter on the column created above
RETURN
COUNTROWS( TableTemp ) //Counting the remaining rows after filtering gives us the result
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
12 | |
9 | |
7 |
User | Count |
---|---|
38 | |
32 | |
29 | |
12 | |
11 |