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

Dax calculation help

Hello, 

 

I need somehelp on Dax calulation. Below is the sample data:

 

I have dataset like below. 

DepartmentGradeNo of Emp
ITA90
ITB90
ITC90
HRA10
HRB5
HRC1
NonITA4
NonITB16
NonITC0
SecurityA5
SecurityB3
SecurityC2

 

Required output is below:

DepartmentNo of Emp
IT90
HR16
NonIT20
Security10

 

Only for 'IT' department i dont want to do the sum of 'No of Emp' column but for all other departments I want to do the sum on 'No of Emp' and display the value. As you can see for IT the value is same 90 in source dataset and output table but for HR in the output table it is 20 (10+5+1). 

 

Can someone please advice how I can get this. Please let me know if I am not clear.

Thank you.

1 ACCEPTED SOLUTION

@Anonymous  In that case, create a new measure as below

 

Test288 = 
VAR _IT = MAXX(FILTER(Test288SumIF,Test288SumIF[Department]="IT"),Test288SumIF[NoOfEmp])
VAR _Other = SUMX(Test288SumIF,Test288SumIF[NoOfEmp])
RETURN IF(SELECTEDVALUE(Test288SumIF[Department])="IT",_IT,_Other)

image.pngimage.pngimage.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

4 REPLIES 4
PattemManohar
Community Champion
Community Champion

@Anonymous  Please try this as a New Table.

 

Test288Out = SUMMARIZE(Test288SumIF,Test288SumIF[Department],"Count",IF(Test288SumIF[Department]="IT",MAX(Test288SumIF[NoOfEmp]),SUM(Test288SumIF[NoOfEmp])))

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Anonymous
Not applicable

Hi @PattemManohar ,

 

Thank you its working but the other thing I would like to add is I want to show 'Department' and 'Grade' as slicers. So when the user select Department = IT and Grade = All then it should show 90 and even if the user select a particular grade lets say 'A' and department = IT it should show 90 only. Any chance its possible please? 

 

Many Thanks

@Anonymous  In that case, create a new measure as below

 

Test288 = 
VAR _IT = MAXX(FILTER(Test288SumIF,Test288SumIF[Department]="IT"),Test288SumIF[NoOfEmp])
VAR _Other = SUMX(Test288SumIF,Test288SumIF[NoOfEmp])
RETURN IF(SELECTEDVALUE(Test288SumIF[Department])="IT",_IT,_Other)

image.pngimage.pngimage.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Anonymous
Not applicable

Thanks alot @PattemManohar . Its working perfectly.

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.