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
aaldo_666
Frequent Visitor

Chart shows max one year back from slicer`s choice

How can I show 4 Quartals back data only on chart based on slicer. Other visuals should show what is selected in slicer.

Goal: If I select 2020 Q1, then on chart I want to see 2021 Q1, Q2, Q3 and 2022 Q1. 

When I select 2021 Q3 I want to see 2020 Q4 and 2021 Q1 Q2 Q3.

But only chart should be affected like this.

Thanks.

aaldo_666_0-1655728136812.png

 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @aaldo_666 ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. Assume that you have a year quarter dimension table as below, then you can create a measure as below:

yingyinr_0-1655967463722.png

Measure = 
VAR _selyear =
    SELECTEDVALUE ( 'YearQuarter'[Year] )
VAR _selquarter =
    SELECTEDVALUE ( 'YearQuarter'[Quarter] )
VAR _qnum =
    VALUE ( RIGHT ( _selquarter, 1 ) )
RETURN
    CALCULATE (
        SUM ( 'Table'[Sales amount] ),
        FILTER (
            'Table',
            IF (
                _qnum = 4,
                'Table'[Year] = _selyear
                    && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) >= 1
                    && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) <= 4,
                (
                    'Table'[Year] = _selyear
                        && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) >= 1
                        && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) <= _qnum
                )
                    || (
                        'Table'[Year] = _selyear - 1
                            && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) >= _qnum + 1
                            && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) <= 4
                    )
            )
        )
    )

yingyinr_1-1655967534285.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
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-yiruan-msft
Community Support
Community Support

Hi @aaldo_666 ,

You can also refer the following links to get it.

Dynamic Last four quarters

Show previous 6 months of data from single slicer selection

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yiruan-msft
Community Support
Community Support

Hi @aaldo_666 ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. Assume that you have a year quarter dimension table as below, then you can create a measure as below:

yingyinr_0-1655967463722.png

Measure = 
VAR _selyear =
    SELECTEDVALUE ( 'YearQuarter'[Year] )
VAR _selquarter =
    SELECTEDVALUE ( 'YearQuarter'[Quarter] )
VAR _qnum =
    VALUE ( RIGHT ( _selquarter, 1 ) )
RETURN
    CALCULATE (
        SUM ( 'Table'[Sales amount] ),
        FILTER (
            'Table',
            IF (
                _qnum = 4,
                'Table'[Year] = _selyear
                    && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) >= 1
                    && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) <= 4,
                (
                    'Table'[Year] = _selyear
                        && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) >= 1
                        && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) <= _qnum
                )
                    || (
                        'Table'[Year] = _selyear - 1
                            && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) >= _qnum + 1
                            && VALUE ( RIGHT ( 'Table'[Quarter], 1 ) ) <= 4
                    )
            )
        )
    )

yingyinr_1-1655967534285.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.