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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
sivarajan21
Post Prodigy
Post Prodigy

Create a Dax return statement using its variable arguments

Hi,

 

I am trying to create a dax measure as below:

sivarajan21_0-1724847015582.png

But I am confused how to refer the variable arguments inside the return statement & so its incomplete.

 

Here is the incomplete measure that i tried:

VT_Profile =
VAR _table = SUMMARIZE(Accruals,Accruals[DBName-Point_Id],Accruals[Date],"Switch Units",[Switch Units],"Accrual Unit Source",[Accrual unit source])

RETURN
CALCULATE(SUM(),)

 

My expected dax measure:

I want to sum the switch units argument from virtual (_table) table variable and filter by its argument Accrual unit Source = "Profile" 

Here is the dax below:

VT_Profile =
VAR _table = SUMMARIZE(Accruals,Accruals[DBName-Point_Id],Accruals[Date],"Switch Units",[Switch Units],"Accrual Unit Source",[Accrual unit source])

RETURN
CALCULATE(SUM(_table(Switch Units),_table(Accrual unit source) = "Profile")

 

PFA file here Financial Management -Tanvi Trial - Copy.pbix

 

Thanks in advance!

@SamWiseOwl @Greg_Deckler @marcorusso @jgeddes @Anonymous @Anonymous @amitchandak 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@sivarajan21 you need to use the SUMX function to iterate over the virtual table and sum the "Switch Units" while applying the filter for "Accrual unit source". 

 

dax
VT_Profile =
VAR _table =
SUMMARIZE(
Accruals,
Accruals[DBName-Point_Id],
Accruals[Date],
"Switch Units", [Switch Units],
"Accrual Unit Source", [Accrual unit source]
)
RETURN
CALCULATE(
SUMX(
FILTER(
_table,
[Accrual Unit Source] = "Profile"
),
[Switch Units]
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@sivarajan21 you need to use the SUMX function to iterate over the virtual table and sum the "Switch Units" while applying the filter for "Accrual unit source". 

 

dax
VT_Profile =
VAR _table =
SUMMARIZE(
Accruals,
Accruals[DBName-Point_Id],
Accruals[Date],
"Switch Units", [Switch Units],
"Accrual Unit Source", [Accrual unit source]
)
RETURN
CALCULATE(
SUMX(
FILTER(
_table,
[Accrual Unit Source] = "Profile"
),
[Switch Units]
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.