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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
yaman123
Post Patron
Post Patron

Show all budget values/periods

Hi all, 

 

I have a table which is formed with a sql statement. There is table A (actual) which has accounting_period, accounting_year, actual_amount, cost centre etc.. 

 

This is then joined to table b (budget) which has columns cost_centre, accounting_period, accounting_year. 

 

The sql statement gives me budget results for periods which exist in table a. 

 

In Power BI, I have added a new table which gives me all my budget data from a spreadsheet with columns accounting_year, period, cost_centre, category, budget_value and i have linked this to the main table. But i can only see the budget periods if they exist in the main table.  I created a merged column in the actual table and a merged column in the budget table.  The columns merged are accounting year, period, category and cost centre. 

 

Is there a measure which will show all budget periods and values even if the period doesnt exist in the main table? 

 

Links.PNG

 

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Use the following:

YTD Actuals =
CALCULATE (
    [Sum Actuals],
    FILTER (
        ALL ( 'Dim Period'[DPeriod] ),
        'Dim Period'[DPeriod] <= MAX ( 'Dim Period'[DPeriod] )
    )
)
YTD Budget =
CALCULATE (
    [Sum Budget Value],
    FILTER (
        ALL ( 'Dim Period'[DPeriod] ),
        'Dim Period'[DPeriod] <= MAX ( 'Dim Period'[DPeriod] )
    )
)
YTD Budget - Actuals = [YTD Budget] - [YTD Actuals]

for...

YTD.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

11 REPLIES 11
PaulDBrown
Community Champion
Community Champion

Use the following:

YTD Actuals =
CALCULATE (
    [Sum Actuals],
    FILTER (
        ALL ( 'Dim Period'[DPeriod] ),
        'Dim Period'[DPeriod] <= MAX ( 'Dim Period'[DPeriod] )
    )
)
YTD Budget =
CALCULATE (
    [Sum Budget Value],
    FILTER (
        ALL ( 'Dim Period'[DPeriod] ),
        'Dim Period'[DPeriod] <= MAX ( 'Dim Period'[DPeriod] )
    )
)
YTD Budget - Actuals = [YTD Budget] - [YTD Actuals]

for...

YTD.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown thank you so much! I will play about with report and the visuals and see the results if they are what i need. I will let you know how i get on! 

PaulDBrown
Community Champion
Community Champion

You need to change the model to include dimension tables for period and category.

You also mention cost centre (which also needs a dimension table) but the field is missing in the sample data you have posted. Can you include it in the data &
can you post some sample data for the budget table please?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi @PaulDBrown 

 

I have posted some sample data below. I have created a category table and linked it to the actual table but still no luck. The 'Other' ctaegory is showing but with no values? 

 

yaman123_0-1630922076141.png

 

In Period 3, there is a value for category 'Other' but when i select period 4 from the slicer, nothing displays. If i select any period, this should show the YTD figure for actual and budget. 

yaman123_1-1630922156238.png

Hope this helps!

Thanks for that but we need actual sample data (not an image) from both the fact and budget tables. You can create sample tables in excel and just copy and paste into your post or better yet, share a sample PBIX file through OneDrive, Google Drive, Dropbox etc...

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi @PaulDBrown 

 

Actual table sample data:

CATEGORYACCOUNTING_PERIODAMOUNT
Consultancy1£200.00
Consultancy3£500.00
Consultancy4-£500.00
IT Costs1£20,000.00
IT Costs2£21,000.00
IT Costs3£30,000.00
IT Costs4£40,000.00
IT Costs5£32,000.00
IT Costs6£2,000.00
Office Costs1£80.00
Office Costs2£80.00
Office Costs4£80.00
Office Costs5£80.00
Other3£275.00
Subscriptions1£0.00
Subscriptions2£40.00
Subscriptions3£0.00
Subscriptions4£2.00
Telephone & Mobile Phones1£1,000.00
Telephone & Mobile Phones2£2,000.00
Telephone & Mobile Phones3£3,000.00
Telephone & Mobile Phones4£4,000.00
Telephone & Mobile Phones5£5,000.00
Travel1£100.00
Travel2£100.00
Travel3£200.00
Travel4£500.00
Travel5£1,000.00

 

Budget table sample data:

CATEGORYPERIODBUDGET_VALUE
Consultancy1£200.00
Consultancy2£200.00
Consultancy3£200.00
Consultancy4£200.00
Consultancy5£200.00
Consultancy6£200.00
Consultancy7£200.00
Consultancy8£200.00
Consultancy9£200.00
Consultancy10£200.00
Consultancy11£200.00
Consultancy12£200.00
IT Costs1£30,000.00
IT Costs2£30,000.00
IT Costs3£30,000.00
IT Costs4£30,000.00
IT Costs5£30,000.00
IT Costs6£32,000.00
IT Costs7£32,000.00
IT Costs8£32,000.00
IT Costs9£32,000.00
IT Costs10£32,000.00
IT Costs11£32,000.00
IT Costs12£32,000.00
Office Costs1£0.00
Office Costs2£0.00
Office Costs3£0.00
Office Costs4£0.00
Office Costs5£0.00
Office Costs6£0.00
Office Costs7£0.00
Office Costs8£0.00
Office Costs9£0.00
Office Costs10£0.00
Office Costs11£0.00
Office Costs12£0.00
Other1£0.00
Other2£0.00
Other3£0.00
Other4£0.00
Other5£0.00
Other6£0.00
Other7£0.00
Other8£0.00
Other9£0.00
Other10£0.00
Other11£0.00
Other12£0.00
Subscriptions1£120.00
Subscriptions2£120.00
Subscriptions3£120.00
Subscriptions4£120.00
Subscriptions5£120.00
Subscriptions6£120.00
Subscriptions7£120.00
Subscriptions8£120.00
Subscriptions9£120.00
Subscriptions10£120.00
Subscriptions11£120.00
Subscriptions12£120.00
Telephone & Mobile Phones1£3,000.00
Telephone & Mobile Phones2£3,000.00
Telephone & Mobile Phones3£3,000.00
Telephone & Mobile Phones4£3,000.00
Telephone & Mobile Phones5£3,000.00
Telephone & Mobile Phones6£3,000.00
Telephone & Mobile Phones7£3,000.00
Telephone & Mobile Phones8£3,000.00
Telephone & Mobile Phones9£3,000.00
Telephone & Mobile Phones10£3,000.00
Telephone & Mobile Phones11£3,000.00
Telephone & Mobile Phones12£3,000.00
Travel1£300.00
Travel2£300.00
Travel3£300.00
Travel4£300.00
Travel5£300.00
Travel6£0.00
Travel7£300.00
Travel8£1,500.00
Travel9£1,500.00
Travel10£1,500.00
Travel11£1,500.00
Travel12£0.00

Thanks for the data. It really helps!

Ok, so following modeling best practices, you need to set up the model with dimension tables for fields common to both fact tables. In your case, we need  dimension tables for period and category.

The model looks like this:

Model.JPGNow we can use the fields from the dimension tables in measures, slicer, filters, visuals etc. These fields from the dimension tables will then filter the relevant rows in each table to create the filter context.

So we can now create measures along the lines of:

 

Sum Actuals = SUM('Actual Table'[AMOUNT])
Sum Budget Value = SUM('Budget Table'[BUDGET_VALUE])
Act - Budget = [Sum Actuals] - [Sum Budget Value]
% vs budget = DIVIDE([Sum Actuals], [Sum Budget Value]) -1

 

Creating a matrix visual using the fields from the dimension tables and the measures, you get....

result.JPG

 

I've attached the sample PBIX file

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi @PaulDBrown 

 

Thanks for that. How would a YTD measure work for this? My current measure is 

Amount YTD =

var SelectedMonth =
MAX(Actual[ACCOUNTING_PERIOD])

RETURN
CALCULATE(
SUM(Actual[AMOUNT]),
FILTER(ALL(Actual[ACCOUNTING_PERIOD]),Actual[ACCOUNTING_PERIOD] <= SelectedMonth))


I would like to create a table which shows columns Category, YTD Actual Amount, YTD Budget Amount, Variance. I have added the 'Period' from the Period table to the slicer, 
v-jingzhang
Community Support
Community Support

Hi @yaman123 

 

Your description is not very clear. "But i can only see the budget periods if they exist in the main table." How do you see the data? If you select data fields into a table visual, did you select budget values/periods fields from Budget File table instead of Actual table into the visual? Do Budget File table have all budget values/periods but Actual table has only part of them?

 

Maybe you can share some sample data (removing sensitive info). This can help us understand the problem better. 

https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...

 

Best Regards,
Community Support Team _ Jing

That did not work. Here is some sample data. 

 

CategoryPeriodAmount
Consultancy15000
Consultancy24000
Other3275
Travel1100
Travel2150
Travel3100
Subscriptions250
Subscriptions350
Subscriptions450

 

This is my YTD measure 

Amount YTD =

var SelectedMonth =
MAX(Actual[ACCOUNTING_PERIOD])

RETURN
CALCULATE(
SUM(Actual[AMOUNT]),
FILTER(ALL(Actual[ACCOUNTING_PERIOD]),Actual[ACCOUNTING_PERIOD] <= SelectedMonth))
 
I also have a budget table which is linked many to many and cross filter is both on merged columns. Merged columns in both tables are year, category, costcentre 
 
The budget table has all the categories and i am using this in the visual but still all categories are not showing with the YTD measures. 
 
I have a budget YTD measure too 
Budget YTD =

CALCULATE(
SUM('Budget File'[BUDGET_VALUE]),
FILTER(ALLEXCEPT('Budget File','Budget File'[CATEGORY]), 'Budget File'[PERIOD] <= MAX(Actual[ACCOUNTING_PERIOD])))
 
Hope this helps!
PaulDBrown
Community Champion
Community Champion

PLease follow the recommendations in this thread to help us help you:

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.