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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
BiDevFred
Regular Visitor

Single select + Column graph

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!

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

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.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

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, 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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