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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Stacked bar chart with different time filtering?

Hi,

 

I need to create a stacked bar chart to show the increase of a value over a period of time.

E.g. in the screenshot below the light blue part is the total, and the dark blue is the increase (in absolute values) in 2019 which I obtained using a YoY quick measure.

 

BUT I have a problem:

the light blue shows the total up to the end of 2019, since that is the setting of the time flter which I have - and which is needed to make the YoY measure work correctly. This is wrong, since I need the light blue to display until end 2018, and the dark only the increase happend in 2019. 

 

Is it possible to apply different time filters to the different elements of a stacked bar chart ? Or how can I get an equivalent result?

 

Thank you!

 


Picture1.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

I do not believe that it is possible to apply different filter to the same measure in the graph. It would apply these filters to the measure instead.

 

I have created a fairly simple version. But you can of course make it more advanced by making the filter context adapt to another measure or alike.

 

I have created two measures:

Value after 2020 = 
CALCULATE(
    SUM( 'Table'[Value]);
    FILTER(
        'Table';
        'Table'[Year] >= 2020
    )
)

Value before 2020 = 
CALCULATE(
    SUM( 'Table'[Value]);
    FILTER(
        'Table';
        'Table'[Year] < 2020
    )
)

Which I then inserted into the graph which returns the following:

test1.PNG

 

I hope this helps or at least leads you in the right direction. 

Kudos is highly appriciated.

 

Br

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous 

 

I do not believe that it is possible to apply different filter to the same measure in the graph. It would apply these filters to the measure instead.

 

I have created a fairly simple version. But you can of course make it more advanced by making the filter context adapt to another measure or alike.

 

I have created two measures:

Value after 2020 = 
CALCULATE(
    SUM( 'Table'[Value]);
    FILTER(
        'Table';
        'Table'[Year] >= 2020
    )
)

Value before 2020 = 
CALCULATE(
    SUM( 'Table'[Value]);
    FILTER(
        'Table';
        'Table'[Year] < 2020
    )
)

Which I then inserted into the graph which returns the following:

test1.PNG

 

I hope this helps or at least leads you in the right direction. 

Kudos is highly appriciated.

 

Br

Anonymous
Not applicable

Marking this one as soluton since although it does not fix entirely my prob, can problem help most of the ppl wiht same issue.

 

Thanks

Anonymous
Not applicable

Hi @Anonymous 

 

Could you then change the 'After 2020' measure to something like below:

Value after 2020 = 
CALCULATE(
    SUM( 'Table'[Value]);
    FILTER(
        'Table';
        'Table'[Year] >= 2020
    )
) - [Value before 2020]

 

Br

Anonymous
Not applicable

Spoiler
Thanks,

for some reasons that still does not work in my case. THe 'AFTER' quick measures keeps reporting values which don't make sense, as if it is double or triple counting .....

Anonymous
Not applicable

@Anonymous  thank you,

 

I tried to explore this but it does not work when I build the measure with values AFTER 2019. 

 

The reason is data sum field is progressive, so it builds up on previous values (e.g I have 2018=2, 2019=5(2+3), 2020=11(5+6), and so on.

 

It works with the 'BEFORE' measure, but when I do the AFTER it does not since I find myself with double counted values...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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