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
Bpark1994
Helper I
Helper I

Need Dax Help Please!

Hi guys

 

I have 2 tables. They are related through the Task column

 

i need to write a calculated column that gives me a count of each task. Seems simple but the part that's tripping me up is if the task is task 3 or 4 then I need the count of those together in the calculated column. The one I wrote doesn't add them together. Here is an example table and my desired result. Thanks!

 

NameTask
John1
John1
John2
Jim1
Jim2
Jane1
Jane2
Mike3
Mike4
Evan3
Evan4

 

 

desired result

TaskCalculated column count
14
23
34
44
3 REPLIES 3
amitchandak
Super User
Super User

@Bpark1994 , Try a measure like

Measure 2 = if( max('Table'[Task]) in {3,4} ,CALCULATE(COUNT('Table'[Name]), 'Table'[Task] in {3,4}), COUNT('Table'[Name]))
amitchandak
Super User
Super User

@Bpark1994 , I think one table is missing. This how you can get new column in table 2 from tbale

Countx(filter(Table1, Table2[Task] =Table1[Task]),Table1[Name])

 

The above one can also done using measure with task

count(Table1[Name])

 

refer: https://www.youtube.com/watch?v=czNHt7UXIe8

Sorry this is not the desired result I am looking for. I don't just want to count the tasks, I also need conditional logic that adds tasks 3 and 4 together as described above. I appreciate the help though!

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.

Top Solution Authors