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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
eyelesszues123
New Member

Sumifs formula to Dax

I'm trying to translate my IF/ Sum IF formula to DAX. I basically want to show the quota attainment for each employee but based on their position. So if they are a manager then the total of the teams attainment should show, not their own. Below is an example and how my SumIfs formula looks. I can get the AE quota to show and but only get as far as showing a simple 1 or 2 if they are a manager/Director

=IF(B3="Rep",F3,IF(B3="Manager",SUMIFS(F:F,C:C,A3),IF(B3="Director",SUMIFS(F:F,D:D,A3),0)))

 

eyelesszues123_0-1713260898856.png

 

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @eyelesszues123, check this. I've also attached pbix file.

 

Result

dufoq3_0-1713263492097.png

 

Total Attainment = 
VAR _rep = SELECTEDVALUE('Table'[Rep Name])
VAR _role = SELECTEDVALUE('Table'[Role])

VAR _result = 
    SWITCH(
        _role,
        "Rep", [Rep Attainment Total],
        "Manager", CALCULATE([Rep Attainment Total], KEEPFILTERS('Table'[Manager] = _rep), REMOVEFILTERS()),
        "Director", CALCULATE([Rep Attainment Total], KEEPFILTERS('Table'[Director] = _rep), REMOVEFILTERS())
    )

RETURN _result

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

3 REPLIES 3
dufoq3
Super User
Super User

Hi @eyelesszues123, check this. I've also attached pbix file.

 

Result

dufoq3_0-1713263492097.png

 

Total Attainment = 
VAR _rep = SELECTEDVALUE('Table'[Rep Name])
VAR _role = SELECTEDVALUE('Table'[Role])

VAR _result = 
    SWITCH(
        _role,
        "Rep", [Rep Attainment Total],
        "Manager", CALCULATE([Rep Attainment Total], KEEPFILTERS('Table'[Manager] = _rep), REMOVEFILTERS()),
        "Director", CALCULATE([Rep Attainment Total], KEEPFILTERS('Table'[Director] = _rep), REMOVEFILTERS())
    )

RETURN _result

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Works Perfectly, thank you @dufoq3 

You're welcome


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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
Top Kudoed Authors