简体   繁体   中英

Calculating difference between daily revenue and budget with Power BI (DirectQuery)

Using Direct Query I am trying to calculate the difference between budgeted and actual revenue per day, working with a monthly budget that is recorded on the first day of each month.

We have managed to calculate the size of the budget per day for each month, dividing the monthly budget by the number of working days that month. Due to the limitations of Direct Query we use a slicer as an input where one can choose the correct number of working days from a list.

We want to be able to subtract the calculated budget per day from the actual revenue that day. Working with data from Entity Store using DirectQuery, our possibilities are limited and we can not add new tables.

Any ideas on how to do this?

Here is a sample of what we have been able to make so far:

样品表

We are using the following tables:

收益表

预算表

#OfWorkDays表

We are also using a standard date table.

Here is the link to a full description of the problem including suggested solutions:

https://community.powerbi.com/t5/Desktop/Calculating-deviation-between-revenue-and-daily-budget-with/mp/560861/highlight/true#M264794

Thanks, Carina

Try using this for your daily budget measure:

Daily Budget =
DIVIDE(
    CALCULATE(
        SUM(Revenue[Actual Revenue]),
        STARTOFMONTH(Revenue[Date])
    ),
    SELECTEDVALUE(NumberOfWorkDays[NumberOfWorkDays], 1)
)

Then your deviation measure can simply be:

Deviation = SUM(Revenue[Actual Revenue]) - [Daily Budget]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM