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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
gumis_rulez
Helper I
Helper I

All months to the one selected in slicer

Hi,

I am trying to make following column graph:

- after choosing the year on the slicer and choosing the month I would like to show a bar chart with sales data from current year with all previous months.

F.e. after setting on slicer 2017 and March, would like to see like this:

003.JPG

After choosing f.e. June 2017, it should show January, February, March, April, May, June sales data.

How to achieve this?

1. I have removed the month slicer interaction on the graph.

2. I am using following measure

Sales 2 =
Var ChoosenMonth = SELECTEDVALUE('Calendar'[Month_ID])
VAR ChoosenYear = SELECTEDVALUE('Calendar'[Year_ID])

RETURN
CALCULATE(
    [Total Sales],
        'Calendar'[Year_ID] = ChoosenYear,
        'Calendar'[Month_ID] <= ChoosenMonth
        )
       
and the result is as follows:
004.JPG

It seams like Variable ChoosenMonth is not working, as it shows correcly year, but not correctly month.

 

On the second hand if I turn on the month slicer interaction on the column chart, the measure shows only data for choosen year and choosen month.

 

005.JPG

 

File: https://drive.google.com/file/d/12msE_DoQPCPszt3y1-fK94wJrc2P_BeD/view?usp=sharing 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @gumis_rulez ,

 

As lbendlin said, you need to go through an unrelated date table if you need to fulfill that requirement, though that also means that all your measure need to be changed.

vtianyichmsft_0-1723514944301.png

vtianyichmsft_1-1723514955987.png

Table = SUMMARIZE('Calendar',[Month_ID],[Year_ID])

Sales 2 = 
Var ChoosenMonth = SELECTEDVALUE('Table'[Month_ID])
VAR ChoosenYear = SELECTEDVALUE('Table'[Year_ID])

RETURN
CALCULATE(
    [Total Sales],
        'Calendar'[Year_ID] = ChoosenYear,
        'Calendar'[Month_ID] <= ChoosenMonth
        )
        

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @gumis_rulez ,

 

As lbendlin said, you need to go through an unrelated date table if you need to fulfill that requirement, though that also means that all your measure need to be changed.

vtianyichmsft_0-1723514944301.png

vtianyichmsft_1-1723514955987.png

Table = SUMMARIZE('Calendar',[Month_ID],[Year_ID])

Sales 2 = 
Var ChoosenMonth = SELECTEDVALUE('Table'[Month_ID])
VAR ChoosenYear = SELECTEDVALUE('Table'[Year_ID])

RETURN
CALCULATE(
    [Total Sales],
        'Calendar'[Year_ID] = ChoosenYear,
        'Calendar'[Month_ID] <= ChoosenMonth
        )
        

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Make sure this does not confuse your users.  Better use a "Before"  slicer.

 

You need a disconnected table to feed your slicer , and measures to calculate the running total/monthly values.

Helpful resources

Announcements
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.