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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Use SUM and COUNT in a measure

Hi,

 

I am trying to count people who have not submitted more than 10 Sales Reports.

I have a column called No_Reports = 1 as Not submitted and 0 as submitted

 

I was trying to use a DAX as below =

 

= CALCULATE(COUNTDistinct(Person[PersonID]), FILTER(Person[No_Report = 1))

 

How do I then look for 10 reports? Please suggest.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey @Anonymous 

Here is the calculated collumn:

SUBMITTED? =
VAR NUM_OF_SUB =
    CALCULATE (
        COUNTROWS ( T23 ),
        FILTER (
            T23,
            T23[Person_EmpID]
                = EARLIER ( T23[Person_EmpID] )
        ),
        FILTER (
            T23,
            T23[Report Not Submitted] = 1
        )
    )
RETURN
    IF (
        NUM_OF_SUB >= 2,
        "NOT Submitted",
        "Submitted"
    )

2019-08-05 09_43_56-papercut - Remote Desktop Connection.png

 

Cheers!
A

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@Anonymous 

Try using an IF()

10Reports = CALCULATE(COUNTDistinct(Person[PersonID]), FILTER(Person[No_Report = 1))) < 10, "YAY", NAY")

Not sure what COUNTDistinct is.

 

Thanks!
A

Anonymous
Not applicable

COUNT distinct is used to count distinct people who are missing more than 10 reports.

Above DAX doesn't seem to work with IF and COUNT in calculate

Anonymous
Not applicable

@Anonymous 

I suggest you will give some sample data.

Also, I couldn't find any function named countdistinct. There is, however, a DISTINCTCOUNT() function.

There is no reason for the formula not to work.

Thanks!
A

Anonymous
Not applicable

Yes its distinctCount.

Here is the Sample for which I am struggling with DAX.

To make it simple lets change it to 2 Reports not submitted.

Nos of Employees who have not submitted more than 2 reports

 

Table Name = Person

Expected Result = 2  (That will be for Emp 1000,3000)

Report Not Submitted = 1  ie "Not Submitted"

Person_EmpIDWK SttratDateReport Not Submitted
10007/7/20191
10007/14/20190
10007/21/20191
10007/28/20191
20007/7/20191
20007/14/20190
20007/21/20190
20007/28/20190
30007/7/20191
30007/14/20190
30007/21/20191
30007/28/20191
Anonymous
Not applicable

Hey @Anonymous 

Here is the calculated collumn:

SUBMITTED? =
VAR NUM_OF_SUB =
    CALCULATE (
        COUNTROWS ( T23 ),
        FILTER (
            T23,
            T23[Person_EmpID]
                = EARLIER ( T23[Person_EmpID] )
        ),
        FILTER (
            T23,
            T23[Report Not Submitted] = 1
        )
    )
RETURN
    IF (
        NUM_OF_SUB >= 2,
        "NOT Submitted",
        "Submitted"
    )

2019-08-05 09_43_56-papercut - Remote Desktop Connection.png

 

Cheers!
A

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.