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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
zhivaninz
Helper I
Helper I

SUMMARIZE and measure using calculated columns returning different results for durations

The use case is processing duration for applications. Historically I've used calculated columns, but I wanted to move into 2022 and transition to using measures. However, when I tested against a test using calculated columns, I found an error I'm keen on understanding. The summarize measure was right - the calculated column, wrong. 

 

Here are my measures for the summarize:

 

 

M100 Intermediate Calendar Days Measure DO NOT USE RAW = 

var tendereddate
= MAX ( PROCESSING[Tendered_date] )

var decideddate
= MAX (PROCESSING[decision_date] )

return
DATEDIFF(
    tendereddate,
    decideddate,
    DAY
)

M101 Average calendar days using SUMMARIZE = 

var virtualtable =
SUMMARIZE(
    PROCESSING,
    PROCESSING[Application_number],
    "calendarduration",
    'Measures Table'[M100 Intermediate Calendar Days Measure DO NOT USE RAW]
)

return
AVERAGEX(
    virtualtable,
    [calendarduration]
)

 

And my column and measure for the other approach:

 

Column =
Calendar Days Tendered to Decision = 
DATEDIFF(
    PROCESSING[Tendered_date],
    PROCESSING[decision_date],
    DAY
)

Measure = 
M102 Average Calendar Days CALCULATE COLUMN = 
AVERAGE(PROCESSING[Calendar Days Tendered to Decision])

 

 

The two measures returned different results. For example, the average for one week was 13.62 using SUMMARIZE, and 14.11 using the calculated column. I then extracted the data at row level (to enable testing) to Excel and did some tests.

 

Both M101 and M102 returned values for 8697 applications (COUNTA)

Both M101 and M102 returned a total sum of 118432 days elapsed (SUM)

Dividing 118432 by 8697 gives 13.62 - not 14.11

So why is M102 behaving differently? It returns the same result as M101 at a row level.

1 ACCEPTED SOLUTION
zhivaninz
Helper I
Helper I

As always, further testing solved it.

The issue was there being duplicate application numbers, with different tendered/decision dates

Filtering both approaches down to the first application meant they returned the same result.

 

I will leave the post up as others may have a similar issue

Summarize, duplicates, duration, calculated column, datediff

View solution in original post

1 REPLY 1
zhivaninz
Helper I
Helper I

As always, further testing solved it.

The issue was there being duplicate application numbers, with different tendered/decision dates

Filtering both approaches down to the first application meant they returned the same result.

 

I will leave the post up as others may have a similar issue

Summarize, duplicates, duration, calculated column, datediff

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.