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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
romovaro
Responsive Resident
Responsive Resident

Grouping Names using department name + Months between 2 dates involving 2 columns

HI Power Bi,

 

I have 2 different questions. Hope you can share some tips

 

First question:

 

1) I have a column with names. I just want to create 2 groups. If the names are the ones below, Team: Pre Engagement Team and if not, the name belongs to the Implementation Team.

 

NameTeam
John SmithPre Engagement Team
Oscar GarciaPre Engagement Team
Schulster, JohnPre Engagement Team
Roger JamesPre Engagement Team

 

 

2) Question

 

I have one column (task) and another one with dates (Task_assigned_ON2)

I need to calculate , by Client_Name or CID, the difference in months or weeks between the date when the "Pre engagement Process" begun until the Date of IPM HandOff.

 

CLIENT_NAMECIDTASKTASK_ASSIGNED_ONTASK_ASSIGNED_ON2
Client A380227IPM HandOff27-JUL-21 07.10.56.000000 PM27-JUL-21
Client A380227Resource Allocation23-JUL-21 04.38.21.000000 PM23-JUL-21
Client A380227Partner Assignment - 965543 - 380227AT0123-JUL-21 02.15.13.000000 PM23-JUL-21
Client A380227Partner Assignment - 965543 - 380227TN0123-JUL-21 02.14.47.000000 PM23-JUL-21
Client A380227Partner Assignment - 965543 - 380227GR0123-JUL-21 02.14.45.000000 PM23-JUL-21
Client A380227Track Welcome Email21-JUN-21 11.42.52.000000 AM21-JUN-21
Client A380227Client System Setup21-JUN-21 11.42.43.000000 AM21-JUN-21
Client A380227Pre Engagement Process21-JUN-21 11.42.43.000000 AM21-JUN-21
Client A380227Greenlight Checks03-JUN-21 01.47.33.000000 PM03-JUN-21
1 ACCEPTED SOLUTION

If you look at my proposal you will notice the " || " in the code - that is DAX speak for "OR",  meaning my proposal already implemented the logic you want to achieve. 

View solution in original post

8 REPLIES 8
parry2k
Super User
Super User

@romovaro maybe it needs a small fix, to wrap AND conditions in its own segment

 

Tasks IPM HandOff & Closed = 0+CALCULATE (
        DISTINCTCOUNT( CELERGO_12062021V1[CID] ),
        ( CELERGO_12062021V1[TASK] = "Pre Engagement Process" && CELERGO_12062021V1[TASK_STATUS] IN {"closed", "Received"} )
||         ( CELERGO_12062021V1[TASK] = "IPM Hand Off" && CELERGO_12062021V1[TASK_STATUS] = "Received" )
        )

 

Follow us on LinkedIn

 

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.

lbendlin
Super User
Super User

The first question is ambiguous. What have you tried and where are you stuck?

 

The second question can be answered with DAX.  Do you want this as a measure or is a calculated column sufficient?

romovaro
Responsive Resident
Responsive Resident

Hi Ibendin

 

For the first question I created a different excel file (Table) with the names I want to see in the report and created a relationship with the column Taskactualperformer. (that has all the names working on the process). The report needs to show only the KPI from some of them. (pre Engagement team) I would like to create a column saysing....if this name; then Pre Engagement Team , if not....else.

 

Tasks IPM HandOff & Closed = VAR result =

    CALCULATE (

        DISTINCTCOUNT( CELERGO_12062021V1[CID] ),

        FILTER (

            CELERGO_12062021V1,

            CELERGO_12062021V1[TASK]

                IN { "Pre Engagement Process" , "Pre Engagement Process" , "IPM HandOff" }

                && CELERGO_12062021V1[TASK_STATUS] IN {"Received", "closed", "Received"}

        )

    )

RETURN

    IF ( ISBLANK ( result ), 0, result )

 

Regarding the formula above...What I need to show is all the tasks that have

Task= Pre Engagement Process and Task_Status="Closed or Received"  and

Task = IPM Hand Off and Task_Status= "Received"

 

with this formula I get 127. (But in the excel file I have 127 Pre engagement process closed/Received" and 18 IPM HandOff received....somethin's missing.

 

and then, once formula is fixed tHe idea is to add...and only for the "Pre-engagement team"...

 

 

 

2) At the end, what managament wants to see if the number of tasks 

How many Task = Pre Engagement Process were task_Status="Received" first day of the month and How many Task=pre Engagement process were Task_Status = closed last day of the month.
Calculated column or value is ok 

 

1.

Tasks IPM HandOff & Closed = 0+CALCULATE (
        DISTINCTCOUNT( CELERGO_12062021V1[CID] ),
        CELERGO_12062021V1[TASK] = "Pre Engagement Process" && CELERGO_12062021V1[TASK_STATUS] IN {"closed", "Received"}
||         CELERGO_12062021V1[TASK] = "IPM Hand Off" && CELERGO_12062021V1[TASK_STATUS] = "Received"
        )
romovaro
Responsive Resident
Responsive Resident

Hi Ibendin

 

thanks. I my excel file i have 106 Pre engagement process (closed or Received) and 4 IPM HandOff with status Received.... 

 

Just noticed that CID is the same in Pre engagement process than IPM handOff, therefore distinctcount cannot be used. 

I used the formula below with your help only using COUNT...but i get the same number 106 (still missing the 4 IPM i guess...)

 

Maybe the correct formula is using the "OR" instead of &&?

 

Task= Pre Engagement Process and Task_Status="Closed or Received"   OR

Task = IPM Hand Off and Task_Status= "Received"

 
COuld you update the formula using or requiremtn 1 "Task= Pre Engagement Process and Task_Status="Closed or Received" " or Requirement 2  "Task = IPM Hand Off and Task_Status= "Received""...please?

 

all task = 0+CALCULATE (
COUNT( 'Celergo-PreEngTeam'[CID] ),
'Celergo-PreEngTeam'[TASK] = "Pre Engagement Process" && 'Celergo-PreEngTeam'[TASK_STATUS] IN {"closed", "Received"}
 
OR
 
'Celergo-PreEngTeam'[TASK] = "IPM Hand Off" && 'Celergo-PreEngTeam'[TASK_STATUS] = "Received"
)
 
CLIENT_NAMECIDINSTANCE_NUMBERTASKTASK2TASK_ASSIGNED_ONTASK_ASSIGNED_ON2TASK_STATUS
Client A3803101122324Start Partner Engagement - 1107560 - 380310ES01Start Partner Engagement - 1107560 - 380310ES0123-NOV-21 05.45.08.000000 PM23-NOV-21Closed
Client A3803101107560IPM HandOffIPM HandOff18-NOV-21 01.06.40.000000 PM18-NOV-21Received
Client A3803101122323Start Partner Engagement - 1107560 - 380310CA01Start Partner Engagement - 1107560 - 380310CA0118-NOV-21 01.06.40.000000 PM18-NOV-21Closed
Pacaso3803101107560Pre Engagement ProcessPre Engagement Process01-OCT-21 02.52.09.000000 PM01-OCT-21Closed

If you look at my proposal you will notice the " || " in the code - that is DAX speak for "OR",  meaning my proposal already implemented the logic you want to achieve. 

romovaro
Responsive Resident
Responsive Resident

HI Ibendlin,

 

it seems I would need the same formula but instead of using the "OR"..

 

I need to provide the total of "Pre Engagement Process - Closed and recevied) like your formula does...

 

all task = 0+CALCULATE (
COUNT('Celergo-PreEngTeam'[CID] ),
'Celergo-PreEngTeam'[TASK] = "Pre Engagement Process" && 'Celergo-PreEngTeam'[TASK_STATUS] IN {"Closed", "Received"}

 

MINUS

 

the IPM HandOff Tasks with status closed.

 

'Celergo-PreEngTeam'[TASK] = "IPM Hand Off" && 'Celergo-PreEngTeam'[TASK_STATUS] = "Closed"

 
romovaro
Responsive Resident
Responsive Resident

thanks Ibendin for your help. THe formula works. I guess I need to check what happens with the missing 4...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors