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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Analitika
Post Prodigy
Post Prodigy

Budget for whole months if day selected

I have budget for each month, but need to see each day fact, so i need in visual chart show budget whole month and fact by day, but if i select days budget do not show at all

Selected whole Month, it ok

Analitika_0-1610536251730.png

Selected day, it is bad, as only facts left

Analitika_1-1610536314329.png

 

Budget =
VAR _yIndex =
MAX ( 'Date'[Year] )
VAR _mIndex =
MAX ( 'Date'[Month] )
VAR _calc =
CALCULATE ( [BudgetTbl], (BudgetTbl[year]) = _yIndex, (BudgetTbl[Month]) = _mIndex )
RETURN
_calc

------------------------------

Fact =
VAR _yIndex =
MAX ( 'Date'[Year] )
VAR _mIndex =
MAX ( 'Date'[Month] )

VAR _calc =
CALCULATE (
[FactTbl],
YEAR ( 'FactTbl'[date] ) = _yIndex
&& MONTH ( 'FactTbl'[date] ) = _mIndex
)
RETURN
_calc
1 ACCEPTED SOLUTION

Not work, i solved problem to set all budgets to start of each month instead of eom, an related date table to it

View solution in original post

9 REPLIES 9
joanwanjiru
Frequent Visitor

 

Budget =

 

VAR Min_Date = STARTOFMONTH('Calendar'[Date])

 

VAR end_month = ENDOFMONTH('Calendar'[Date])

 

RETURN

CALCULATE(

    SUM(budget[Value]),

   DATESBETWEEN('Calendar'[Date], Min_Date, end_month))

This could also help 

Anonymous
Not applicable

Hi @Analitika ,

As I mocked some sample data and create the column chart using your measures, I can't reproduce the problem(see below screenshot). Could you please provide some sample data in BudgetTbl and FactTbl table? And how did you set your column chart? Thank you.

Budget for whole months if day selected.JPG

Best Regards

@Anonymous  Did you select day?

Analitika_0-1610691974179.png

 

Anonymous
Not applicable

Hi @Analitika ,

Both budget and fact values can display in column chart when I select the day as shown in the below screenshot. By the way, the date in X axis of my column chart is from Date field of table Date...

Budget for whole months if day selected_2.JPG

Best Regards

@Anonymous 
Did your fact table have each day values? My have each day

Did your budget table have each day values? My have only whole month
Could you please share your file?

Anonymous
Not applicable

Hi @Analitika ,

The attachment is my sample pbix file, you can check whether there is any difference with yours.

Best Regards

@Anonymous  You dont have relations between dates, add them and you will see a problem

Anonymous
Not applicable

Hi @Analitika ,

Please try to update the formula of measure as below and check whether it can get your desired result:

Budget =
VAR _yIndex =
    MAX ( 'Date'[Year] )
VAR _mIndex =
    MAX ( 'Date'[Month] )
VAR _calc =
    CALCULATE (
        SUM ( 'BudgetTbl'[Budgets] ),
         ( BudgetTbl[year] ) = _yIndex,
         ( BudgetTbl[Month] ) = _mIndex,
        ALL ( 'Date'[Date] )
    )
RETURN
    _calc
Fact =
VAR _yIndex =
    MAX ( 'Date'[Year] )
VAR _mIndex =
    MAX ( 'Date'[Month] )
VAR _calc =
    CALCULATE (
        SUM ( 'FactTbl'[Facts] ),
        YEAR ( 'FactTbl'[date] ) = _yIndex
            && MONTH ( 'FactTbl'[date] ) = _mIndex,
        ALL ( 'Date'[Date] )
    )
RETURN
    _calc

Best Regards

Not work, i solved problem to set all budgets to start of each month instead of eom, an related date table to it

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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