cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
olexi
Frequent Visitor

Add records for missing dates into the table

Hi! Could someone help to fix this calculation or provide an advice?

There is a large table Production that has Date, Model, Part columns (among others). There is a measure TakeRate that calculates a historical ratio of part per model - this one is working properly. There is also another measure Plan to calculate a Model plan volume per Date that is located in another table, also working correctly. The calculation that fails is called Estimate and it multiplies TakeRate by Plan and aggregates within Production table - rows roll-up is needed as TakeRate produces wrong results at a higer level due to a nature of this calculation. Now, the problem is that Production table doesn't have records for all dates for each Part and Model combination, so Plan for these dates is not included into a calculation.

 

Estimate = 
   VAR PartModels = 
   //ADDMISSINGITEMS( 'Date'[MonthDate], 'Model'[model],
   SUMMARIZE( 
        Production,
        'Date'[MonthDate],
        'Model'[model],
        Production[part_no])
    //, 'Date'[MonthDate], 'Model'[model])

    VAR RollUp = 
     SUMX( PartModels,
        [Plan] * [TakeRate]
    )
RETURN RollUp 

 

1 ACCEPTED SOLUTION
olexi
Frequent Visitor

It turned out that when I do not include 'Date'[MonthDate] into SUMMARIZE, it works and aggregates as it should.

View solution in original post

2 REPLIES 2
olexi
Frequent Visitor

It turned out that when I do not include 'Date'[MonthDate] into SUMMARIZE, it works and aggregates as it should.

View solution in original post

Fowmy
Super User IV
Super User IV

@olexi 

I am not sure how the measures [Plan] and [RakeRate] are constructed but to create all combinations including the missing dates you can try using the either CROSSJOIN or GENERATE functions within your measure.

 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

 

 

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Website   YouTube    LinkedIn

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors