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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kky1
Helper II
Helper II

Argument 3 in CALCULATE function is required - syntax error?

Hello community - I am getting the error "Argument 3 in CALCULATE function is required for this DAX measure. Reading other posts, most of these appear to be a syntax such  as an extra comma but I am having trouble spotting it in my code. Can anyone assist?

 

Gender All or selectedInstitutiton_v2: = //used table and measures so there is space between bars on bar charts
//need this so that bar chart retains percentage when only 1 gender selected
VAR __selectedID  = SELECTEDVALUE('parameterInstitution'[shortDisplayName])  
RETURN
IF (
    __selectedID = 'parameterInstitution'[SlicerSelection] && __selectedID in VALUES('Dim_Institutions'[shortDisplayName]),
VAR __selectedUnitID =
CALCULATE(
    MAX('Faculty IPEDS Diversity'[UNITID]),
     'Dim_Institutions'[shortDisplayName] = __selectedID
)
VAR __selected_gender_sel =
CALCULATE(
    SUM('Faculty IPEDS Diversity'[Count]),
    'Peer Groups'[UnitID]=__selectedUnitID, //variable selectedInstitution
)
VAR __all_sel=
CALCULATE(
    SUM('Faculty IPEDS Diversity'[Count]),
    'Peer Groups'[UnitID]=__selectedUnitID, //variable selectedInstitution
    ALL('Faculty IPEDS Diversity'[Sex])
)
VAR __psu=
DIVIDE(
    __selected_gender_sel, __all_sel
)
VAR __selected_gender_all =
CALCULATE(
    SUM('Faculty IPEDS Diversity'[Count])
)
VAR __allgender=
CALCULATE(
    SUM('Faculty IPEDS Diversity'[Count]),
    ALL('Faculty IPEDS Diversity'[Sex])
)
VAR __all=
DIVIDE(
    __selected_gender_all, __allgender
)
VAR __selection=
SELECTEDVALUE('PSU/All Slicer Table'[Sort])
RETURN
SWITCH(
    TRUE(),
    __selection = 1, __psu,
    __selection = 2, __all
))
 
kky1_0-1707835449496.png

Thank you @kky1 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@kky1 , remove comma in this

 

VAR __selected_gender_sel =
CALCULATE(
SUM('Faculty IPEDS Diversity'[Count]),
'Peer Groups'[UnitID]=__selectedUnitID, //variable selectedInstitution
)

 

 

like

 

 

VAR __selected_gender_sel =
CALCULATE(
SUM('Faculty IPEDS Diversity'[Count]),
'Peer Groups'[UnitID]=__selectedUnitID //variable selectedInstitution
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
kky1
Helper II
Helper II

Thanks so much @amitchandak - that was the ticket! Much appreciated for your quick eye on that!!

amitchandak
Super User
Super User

@kky1 , remove comma in this

 

VAR __selected_gender_sel =
CALCULATE(
SUM('Faculty IPEDS Diversity'[Count]),
'Peer Groups'[UnitID]=__selectedUnitID, //variable selectedInstitution
)

 

 

like

 

 

VAR __selected_gender_sel =
CALCULATE(
SUM('Faculty IPEDS Diversity'[Count]),
'Peer Groups'[UnitID]=__selectedUnitID //variable selectedInstitution
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.