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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AndreT
Helper I
Helper I

What's wrong with this formula?

Hi,

I just wanted to check what is wrong with this formula?

 

Closed with Task = OR(CALCULATE(DISTINCTCOUNT(Task[Job ID (Task) ]),'Task'[Job.Status__c]="Closed"), CALCULATE(DISTINCTCOUNT(Task[Job ID (Task) ]),'Task'[Job.Status__c]="Paymnet_Entry"))

Want to count jobs which either are closed or are in payment_entry status.

 

After entering this forumla I don't get any results at all.

1 ACCEPTED SOLUTION

Ah, got ya.

 

I believe this will work:

 

DistinctCount.Open.PaymentEntry = CALCULATE(
                                             DISTINCTCOUNT( Task2[Job_ID] ),
                                                    FILTER( Task2 ,
                                                               Task2[Job_Status] = "Closed"
                                                           ||  Task2[Job_Status] = "Payment Entry")
)

View solution in original post

5 REPLIES 5
GabrielSantos
Resolver I
Resolver I

Hey there!

 

I believe you'll be able to achieve your desired result with a simpler code. 

 

Try this:

 

Count Closed.PaymentEntry = COUNTROWS(
                                       FILTER( Task ,
                                                   Task[Job_Status] = "Closed"
                                               ||  Task[Job_Status] = "Payment Entry" )
)

In short, we use the countrows function to count the rows of a table that we filter to only include rows with "Closed" or "Payment Entry" job statuses. The || is the "or" operator.

 

 

Hey,
It would work only if all tasks had unique job id. Because there are jobs with mulitple taks I have to use distinct count.

Hi @AndreT,

The formula @GabrielSantos posted is right. Please try it and mark the right reply as answer if you have resolved your issue.

Best Regards,
Angelia

Ah, got ya.

 

I believe this will work:

 

DistinctCount.Open.PaymentEntry = CALCULATE(
                                             DISTINCTCOUNT( Task2[Job_ID] ),
                                                    FILTER( Task2 ,
                                                               Task2[Job_Status] = "Closed"
                                                           ||  Task2[Job_Status] = "Payment Entry")
)

Thank you, it worked.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors