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
romovaro
Post Partisan
Post Partisan

calculate formula

 

HI

 

I have a question regarding DAX formula for the table below.

CLIENT_NAMECIDINSTANCE_NUMBERTASKTASK_STATUSTASK_COMPLETED_DATECUID
Customer 110002831199226Partner Acknowledgement - 1179493 - 1000283NO01Received 1000283NO01
Customer 110002831199224Partner Acknowledgement - 1179493 - 1000283DK01Received 1000283DK01
Customer 110002831199226Start Partner Engagement - 1179493 - 1000283NO01Closed21-DEC-21 10.58.55.181000 AM1000283NO01
Customer 110002831199224Start Partner Engagement - 1179493 - 1000283DK01Closed21-DEC-21 10.58.18.535000 AM1000283DK01
Customer 110002831199225Partner Acknowledgement - 1179493 - 1000283NL01Received 1000283NL01
Customer 110002831179493Central Kick OffReceived  
Customer 110002831179493IPM HandOffClosed16-DEC-21 03.05.00.528000 PM 
Customer 110002831199225Start Partner Engagement - 1179493 - 1000283NL01Closed16-DEC-21 03.08.45.815000 PM1000283NL01
Customer 110002831199228Partner Assignment - 1179493 - 1000283GB01Received 1000283GB01
Customer 110002831199225Partner Assignment - 1179493 - 1000283NL01Closed15-DEC-21 01.39.14.851000 PM1000283NL01
Customer 110002831199227Partner Assignment - 1179493 - 1000283RU01Received 1000283RU01
Customer 110002831199224Partner Assignment - 1179493 - 1000283DK01Closed17-DEC-21 02.53.07.009000 PM1000283DK01
Customer 110002831199226Partner Assignment - 1179493 - 1000283NO01Closed20-DEC-21 12.14.43.514000 PM1000283NO01
Customer 110002831179493Resource AllocationClosed15-DEC-21 04.05.50.863000 PM 
Customer 110002831179493Track Welcome EmailClosed14-DEC-21 09.18.48.935000 AM 
Customer 110002831179493Pre Engagement ProcessClosed15-DEC-21 11.24.57.889000 AM 
Customer 110002831179493Client System SetupClosed14-DEC-21 01.32.30.414000 PM 
Customer 110002831179493Greenlight ChecksClosed30-NOV-21 05.08.57.840000 PM 

 

I want to create a formula that calculates using the CID column and task Greenlights Checks and Closed

 

and returns a list of "distinccount" cuids from that CUID.

 

In the example above for customer CID = 1000283

The list of CUID should be;

1000283GB01
1000283NL01
1000283RU01
1000283DK01
1000283NO01

 

I was thinking:

 

GreenLights Checks =
var tab =
CALCULATETABLE (
VALUES ( 'BMPS LOF Report'[CID] ),
FILTER (
'BMPS LOF Report',
'BMPS LOF Report'[TASK] = "Greenlight Checks"
&& 'BMPS LOF Report'[TASK_STATUS] = "Closed"
)
)
return
CALCULATE (
...and then I will need the CUID part
 
Thanks and Happy weekend
 
 

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@romovaro try this:

 

eenLights-Recount CUIDS =
var tab =
CALCULATETABLE (
VALUES ( 'BMPS LOF Report'[CID] ),
'BMPS LOF Report'[TASK] = "Greenlight Checks",
'BMPS LOF Report'[TASK_STATUS] = "Closed"
)
return
CALCULATE (
DISTINCTCOUNT( 'BMPS LOF Report'[CUID] ),
INTERSECT ( VALUES('BMPS LOF Report'[CID] ), tab ),
NOT ISBLANK ( 'BMPS LOF Report'[CUID] )
)

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@romovaro try this:

 

eenLights-Recount CUIDS =
var tab =
CALCULATETABLE (
VALUES ( 'BMPS LOF Report'[CID] ),
'BMPS LOF Report'[TASK] = "Greenlight Checks",
'BMPS LOF Report'[TASK_STATUS] = "Closed"
)
return
CALCULATE (
DISTINCTCOUNT( 'BMPS LOF Report'[CUID] ),
INTERSECT ( VALUES('BMPS LOF Report'[CID] ), tab ),
NOT ISBLANK ( 'BMPS LOF Report'[CUID] )
)

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@romovaro I think I have a video on a similar task, check it here https://youtu.be/zS1IDl3DLak

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

HI Parry

 

Video looks good. Facing some problems but I will check again. In the meantime i updated the formula to get the Total Counts of CUIDs:

 

reenLights-Recount CUIDS =
var tab =
CALCULATETABLE (
VALUES ( 'BMPS LOF Report'[CID] ),
FILTER (
'BMPS LOF Report',
'BMPS LOF Report'[TASK] = "Greenlight Checks"
&& 'BMPS LOF Report'[TASK_STATUS] = "Closed"
)
)
return
CALCULATE (
DISTINCTCOUNT( 'BMPS LOF Report'[CUID] ),
INTERSECT ( VALUES('BMPS LOF Report'[CID] ), tab )
)
 
But the formula counts the "Blank Space" as a distinccount...and it's wrong. Null should not be in the total count.
CUID
380305CA01
BLANK
380305AE01
380305SA01
380305BH01
380305TW01
380305JP01
380305KR01
380305MY01
380305MX01
380305SG01
380305SG02

 

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.