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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
hemanthk
New Member

How to get Sum on Total Row for a measure in DirectQuery?

Hi,

I have a measure to get the days between two dates and I want the total of this measure to be Sum, but it is giving me a MIN value on the total row of the Table Visual.

I am using DirectQuery.

My measure is like below:

1_WDays =
VAR BEGDATE = MIN('ZTAQ_CP03_V01'[Position Open (Posted) Date])
VAR ENDDATE = MIN('ZTAQ_CP03_V01'[Position Hired Date])
VAR HOLIDAYS = CALCULATE(DISTINCTCOUNT('BU Holidays'[Date]),FILTER('BU Holidays', 'BU Holidays'[Date] >= BEGDATE && 'BU Holidays'[Date] <= ENDDATE))
VAR WEEKENDS = CALCULATE(DISTINCTCOUNT(CAL[Date]),FILTER(CAL, CAL[Date] >= BEGDATE && CAL[Date] <= ENDDATE && WEEKDAY(CAL[Date], 2) > 5))
RETURN (DATEDIFF(BEGDATE, ENDDATE, DAY) - HOLIDAYS - WEEKENDS)
 
Can you please suggest how to get the Sum for this measure in DirectQuery.
 
Sum_Measure.png
2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

Rename your current measure to be "1_Wdays individual" then create a new measure

1_Wdays = IF( ISINSCOPE('Table'[Position number]), [1_Wdays individual],
var summaryTable = ADDCOLUMNS( SUMMARIZE( 'Table', 'Table'[Position number]), 
"@value", [1_Wdays individual])
return SUM( summaryTable, [@value])
)

View solution in original post

Hi,

I fixed it by creating a New Table instead of another measure and adding DAX: ADDCOLUMNS and SUMMARIZE functions to it.

Thanks, John for your input.

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

Rename your current measure to be "1_Wdays individual" then create a new measure

1_Wdays = IF( ISINSCOPE('Table'[Position number]), [1_Wdays individual],
var summaryTable = ADDCOLUMNS( SUMMARIZE( 'Table', 'Table'[Position number]), 
"@value", [1_Wdays individual])
return SUM( summaryTable, [@value])
)

Hi @johnt75 ,

Thank you for your response.

I tried the code as below:

Sum_Measure.png
 
I am getting error: Too many arguments passed to SUM Function.
Can you please let me know what should be corrected?

Hi,

I fixed it by creating a New Table instead of another measure and adding DAX: ADDCOLUMNS and SUMMARIZE functions to it.

Thanks, John for your input.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.