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












1














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:



Sample table



We are using the following tables:



Revenue table



Budget table



#OfWorkDays table



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/m-p/560861/highlight/true#M264794



Thanks,
Carina










share|improve this question
























  • You need to put some examples with sample data. Read the community standards for question posting.
    – Rahul Neekhra
    Nov 12 '18 at 9:52






  • 1




    This doesn't address your main question, but why don't you use a column on your date table to indicate which days are working days to remove the need for the slicer with the number of working days. Your calculated budget per day would then need to count the number of working days in the month. This has the advantage, though, that you can get it to show zero budget on non-working days.
    – Gordon K
    Nov 12 '18 at 9:53










  • The post is now updated with sample data. That is a good idea, but as working days and holidays move from year to year (and our date table consists of several thousand rows) it is not that easy to do.
    – Carina
    Nov 12 '18 at 11:47


















1














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:



Sample table



We are using the following tables:



Revenue table



Budget table



#OfWorkDays table



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/m-p/560861/highlight/true#M264794



Thanks,
Carina










share|improve this question
























  • You need to put some examples with sample data. Read the community standards for question posting.
    – Rahul Neekhra
    Nov 12 '18 at 9:52






  • 1




    This doesn't address your main question, but why don't you use a column on your date table to indicate which days are working days to remove the need for the slicer with the number of working days. Your calculated budget per day would then need to count the number of working days in the month. This has the advantage, though, that you can get it to show zero budget on non-working days.
    – Gordon K
    Nov 12 '18 at 9:53










  • The post is now updated with sample data. That is a good idea, but as working days and holidays move from year to year (and our date table consists of several thousand rows) it is not that easy to do.
    – Carina
    Nov 12 '18 at 11:47
















1












1








1







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:



Sample table



We are using the following tables:



Revenue table



Budget table



#OfWorkDays table



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/m-p/560861/highlight/true#M264794



Thanks,
Carina










share|improve this question















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:



Sample table



We are using the following tables:



Revenue table



Budget table



#OfWorkDays table



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/m-p/560861/highlight/true#M264794



Thanks,
Carina







powerbi dax m






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 16:49









Alexis Olson

12.8k21634




12.8k21634










asked Nov 12 '18 at 9:26









Carina Carina

62




62












  • You need to put some examples with sample data. Read the community standards for question posting.
    – Rahul Neekhra
    Nov 12 '18 at 9:52






  • 1




    This doesn't address your main question, but why don't you use a column on your date table to indicate which days are working days to remove the need for the slicer with the number of working days. Your calculated budget per day would then need to count the number of working days in the month. This has the advantage, though, that you can get it to show zero budget on non-working days.
    – Gordon K
    Nov 12 '18 at 9:53










  • The post is now updated with sample data. That is a good idea, but as working days and holidays move from year to year (and our date table consists of several thousand rows) it is not that easy to do.
    – Carina
    Nov 12 '18 at 11:47




















  • You need to put some examples with sample data. Read the community standards for question posting.
    – Rahul Neekhra
    Nov 12 '18 at 9:52






  • 1




    This doesn't address your main question, but why don't you use a column on your date table to indicate which days are working days to remove the need for the slicer with the number of working days. Your calculated budget per day would then need to count the number of working days in the month. This has the advantage, though, that you can get it to show zero budget on non-working days.
    – Gordon K
    Nov 12 '18 at 9:53










  • The post is now updated with sample data. That is a good idea, but as working days and holidays move from year to year (and our date table consists of several thousand rows) it is not that easy to do.
    – Carina
    Nov 12 '18 at 11:47


















You need to put some examples with sample data. Read the community standards for question posting.
– Rahul Neekhra
Nov 12 '18 at 9:52




You need to put some examples with sample data. Read the community standards for question posting.
– Rahul Neekhra
Nov 12 '18 at 9:52




1




1




This doesn't address your main question, but why don't you use a column on your date table to indicate which days are working days to remove the need for the slicer with the number of working days. Your calculated budget per day would then need to count the number of working days in the month. This has the advantage, though, that you can get it to show zero budget on non-working days.
– Gordon K
Nov 12 '18 at 9:53




This doesn't address your main question, but why don't you use a column on your date table to indicate which days are working days to remove the need for the slicer with the number of working days. Your calculated budget per day would then need to count the number of working days in the month. This has the advantage, though, that you can get it to show zero budget on non-working days.
– Gordon K
Nov 12 '18 at 9:53












The post is now updated with sample data. That is a good idea, but as working days and holidays move from year to year (and our date table consists of several thousand rows) it is not that easy to do.
– Carina
Nov 12 '18 at 11:47






The post is now updated with sample data. That is a good idea, but as working days and holidays move from year to year (and our date table consists of several thousand rows) it is not that easy to do.
– Carina
Nov 12 '18 at 11:47














1 Answer
1






active

oldest

votes


















0














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]





share|improve this answer





















  • Thanks! I tried your solution, but it still doesn't work. I think the problem might be that in the budget table the only date is the first of each month, as that is when the budget is recorded. We tried to copy and merge the date and the budget table to get all dates into the budget table - but that changes the storage mode to import mode, which we cannot work with in this case.
    – Carina
    Nov 13 '18 at 10:06










  • It worked fine when I tried to replicate it. Can you share a PBIX?
    – Alexis Olson
    Nov 13 '18 at 14:44











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259184%2fcalculating-difference-between-daily-revenue-and-budget-with-power-bi-directque%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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]





share|improve this answer





















  • Thanks! I tried your solution, but it still doesn't work. I think the problem might be that in the budget table the only date is the first of each month, as that is when the budget is recorded. We tried to copy and merge the date and the budget table to get all dates into the budget table - but that changes the storage mode to import mode, which we cannot work with in this case.
    – Carina
    Nov 13 '18 at 10:06










  • It worked fine when I tried to replicate it. Can you share a PBIX?
    – Alexis Olson
    Nov 13 '18 at 14:44
















0














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]





share|improve this answer





















  • Thanks! I tried your solution, but it still doesn't work. I think the problem might be that in the budget table the only date is the first of each month, as that is when the budget is recorded. We tried to copy and merge the date and the budget table to get all dates into the budget table - but that changes the storage mode to import mode, which we cannot work with in this case.
    – Carina
    Nov 13 '18 at 10:06










  • It worked fine when I tried to replicate it. Can you share a PBIX?
    – Alexis Olson
    Nov 13 '18 at 14:44














0












0








0






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]





share|improve this answer












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]






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 '18 at 17:07









Alexis OlsonAlexis Olson

12.8k21634




12.8k21634












  • Thanks! I tried your solution, but it still doesn't work. I think the problem might be that in the budget table the only date is the first of each month, as that is when the budget is recorded. We tried to copy and merge the date and the budget table to get all dates into the budget table - but that changes the storage mode to import mode, which we cannot work with in this case.
    – Carina
    Nov 13 '18 at 10:06










  • It worked fine when I tried to replicate it. Can you share a PBIX?
    – Alexis Olson
    Nov 13 '18 at 14:44


















  • Thanks! I tried your solution, but it still doesn't work. I think the problem might be that in the budget table the only date is the first of each month, as that is when the budget is recorded. We tried to copy and merge the date and the budget table to get all dates into the budget table - but that changes the storage mode to import mode, which we cannot work with in this case.
    – Carina
    Nov 13 '18 at 10:06










  • It worked fine when I tried to replicate it. Can you share a PBIX?
    – Alexis Olson
    Nov 13 '18 at 14:44
















Thanks! I tried your solution, but it still doesn't work. I think the problem might be that in the budget table the only date is the first of each month, as that is when the budget is recorded. We tried to copy and merge the date and the budget table to get all dates into the budget table - but that changes the storage mode to import mode, which we cannot work with in this case.
– Carina
Nov 13 '18 at 10:06




Thanks! I tried your solution, but it still doesn't work. I think the problem might be that in the budget table the only date is the first of each month, as that is when the budget is recorded. We tried to copy and merge the date and the budget table to get all dates into the budget table - but that changes the storage mode to import mode, which we cannot work with in this case.
– Carina
Nov 13 '18 at 10:06












It worked fine when I tried to replicate it. Can you share a PBIX?
– Alexis Olson
Nov 13 '18 at 14:44




It worked fine when I tried to replicate it. Can you share a PBIX?
– Alexis Olson
Nov 13 '18 at 14:44


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259184%2fcalculating-difference-between-daily-revenue-and-budget-with-power-bi-directque%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Full-time equivalent

さくらももこ

13 indicted, 8 arrested in Calif. drug cartel investigation