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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Kudoed Authors