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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. 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
v-tianyich-msft
Community Support
Community Support

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
v-tianyich-msft
Community Support
Community Support

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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