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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.