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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
rstover_atx
Frequent Visitor

Actuals vs Plan using Treatas and Summarize

I have a model I am building to compare Actual Sales Bookings from Salesforce vs Budget. The dimensional data from our actuals table is very robust as it leverages several key salesforce objects like opportunities and accounts. The plan data, however, is only constructed in excel and at a minimal granularity (Booking Event, Product Family, and Date). To Calculate the Plan Measure, I use the following formula:

 

 

Booking PL = 

CALCULATE (
    SWITCH (
        [Selected Calculation],
        1, SUM(FCT_PLAN_BOOKINGS[VALUE]),
        2, CALCULATE ( SUM(FCT_PLAN_BOOKINGS[VALUE]), DATESQTD ( Periods[Date] ) ),
        3, CALCULATE ( SUM(FCT_PLAN_BOOKINGS[VALUE]), DATESYTD ( Periods[Date] ) )
    ),
    TREATAS(
        SUMMARIZE(
            FCT_SFDC_BOOKINGS,
            FCT_SFDC_BOOKINGS[PRODUCT_FAMILY],
            FCT_SFDC_BOOKINGS[BOOKING_SUMMARY],
            FCT_SFDC_BOOKINGS[BOOKING_DATE]),
            FCT_PLAN_BOOKINGS[PRODUCT_FAMILY],
            FCT_PLAN_BOOKINGS[CATEGORY],
            FCT_PLAN_BOOKINGS[DATE]
    )
)
            

 

 

The Issue: When a given product family.booking_summary.date value is blank from the actuals (so effectively $0)  ,  the measure above does not return the total Plan value. 

 

Truncated Data Set ( FCT_PLAN_BOOKINGS)

 

Product FamilyDateCategoryValue
TR - MarketView6/1/2021Churn       (192,983.60)
TR - Datagenic6/1/2021Churn           (6,077.66)

 

Truncated Date Set (FCT_SFDC_BOOKINGS)

 

 

Product FamilyDateBooking_summaryBooking_value
TR - MarketView6/1/2021Churn       (90,961.49)

 

Sample Visual

Treatas Example.PNG

 

As you can see, because the TR - Dategenic family doesn't have an actual, it filters out the Budget value. 

 

Is there a modeling approach I am missing here?

 

Here is the current Data Model 

Bookings Model.PNG

3 REPLIES 3
rstover_atx
Frequent Visitor

I ended up utilizing SQLBI's guide for returning zero. 

 

Creating this measure did the trick:

 

Booking Value = 
VAR FirstBookingValue = 
    CALCULATE( MIN(FCT_SFDC_BOOKINGS[BOOKING_DATE]), ALLEXCEPT( FCT_SFDC_BOOKINGS, 'FCT_SFDC_BOOKINGS'[OPPORTUNITY_PRODUCT_NAME] ))
VAR LastBookingValue = 
    CALCULATE( MAX(FCT_SFDC_BOOKINGS[BOOKING_DATE]), REMOVEFILTERS())
VAR CurrentDate = MAX(Periods[Date])
VAR ForceZero = FirstBookingValue <= CurrentDate && CurrentDate <= LastBookingValue
VAR Amt = [Booking AC] + if (ForceZero, 0)
Return
    Amt

 

m3tr01d
Continued Contributor
Continued Contributor

@rstover_atx You could try replacing your big Treatas expression by these two 

TREATAS( VALUES( FCT_SFDC_BOOKINGS[PRODUCT_FAMILY] ), FCT_PLAN_BOOKINGS[PRODUCT_FAMILY] ),
TREATAS( VALUES( FCT_SFDC_BOOKINGS[BOOKING_SUMMARY] ), FCT_PLAN_BOOKINGS[CATEGORY] )

 

daxer-almighty
Solution Sage
Solution Sage

Your TREATAS is incorrect syntactically. The measure should not even be accepted in PBI.

 

https://dax.guide/treatas 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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