Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hey Community
I have a report page showing YTD Costs, with a setup where a single year and month can be chosen, and it benchmarks for the same period last year. In my bar chart, there is only one month displayed when i choose "March", However i want it to show January, February and March in individual bars, and so forth, all the way to december, so that if december is chosen, it displays 12 bars, one for each month of the year. I have limited acces, so i dont have the ability to make tables and edit relationships, and also no parameters. Basically, it has to be done only with measures.
I have tried many solutions, but none that worked, please help!
Hello @BiDevFred,
Can you please try this:
1. Create a measure for the Maximum Month Number
Max Month Number = 
MAX('DateTable'[MonthNumber])2. Filter Bar Chart by Max Month
Filter Months = 
VAR CurrentMonth = 'DateTable'[MonthNumber]
RETURN
IF(CurrentMonth <= [Max Month Number], 1, BLANK())3. Display YTD Costs
YTD Costs = 
VAR CurrentMonth = 'DateTable'[MonthNumber]
VAR CurrentYear = MAX('DateTable'[Year])
RETURN
IF([Filter Months] = 1,
    CALCULATE(
        SUM('DataTable'[Costs]),
        FILTER(
            ALL('DateTable'),
            'DateTable'[Year] = CurrentYear &&
            'DateTable'[MonthNumber] <= CurrentMonth
        )
    ),
    BLANK()
)4. Display LYTD (Last Year To Date) Costs
LYTD Costs = 
VAR CurrentMonth = 'DateTable'[MonthNumber]
VAR CurrentYear = MAX('DateTable'[Year])
VAR LastYear = CurrentYear - 1
RETURN
IF([Filter Months] = 1,
    CALCULATE(
        SUM('DataTable'[Costs]),
        FILTER(
            ALL('DateTable'),
            'DateTable'[Year] = LastYear &&
            'DateTable'[MonthNumber] <= CurrentMonth
        )
    ),
    BLANK()
)Should you require any further assistance, please do not hesitate to reach out to me.
Hello Sahir, thanks for answering.
Filter Months = VAR CurrentMonth = 'DateTable'[MonthNumber] RETURN IF(CurrentMonth <= [Max Month Number], 1, BLANK())
 VAR CurrentMonth = Wont let me choose the datetable, only measures i have created
Sincerely,
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
            | User | Count | 
|---|---|
| 8 | |
| 5 | |
| 5 | |
| 4 | |
| 3 | 
| User | Count | 
|---|---|
| 24 | |
| 11 | |
| 10 | |
| 9 | |
| 8 |