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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Variance between two measures

I have a set of data with a Year-Week column.

I want to create a couple of measures for This Year QUS and Last Year QUS so I can see the year on year variance.

So effectively it will show Year-Week 2018-50 as one measure and 2017-50 as another.

Also, when I have a slicer with the Year-Weeks in if I selected 2018-49 it would then show 2017-49.

If I had a date column I could use SAMEPERIODLASTYEAR but unfortunately I don't

Variance Power BI.JPG

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may create the Year column and Week column. Then you may get the last year QUS as below.

LastYearQUS =
CALCULATE (
    [QUS],
    FILTER (
        ALL ( Table ),
        Table[Year]
            = SELECTEDVALUE ( Table[Year] ) - 1
            && Table[Week] = SELECTEDVALUE ( Table[Week] )
    )
)

2.png

Regards,

Cherie

Community Support Team _ Cherie Chen
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

4 REPLIES 4
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may create the Year column and Week column. Then you may get the last year QUS as below.

LastYearQUS =
CALCULATE (
    [QUS],
    FILTER (
        ALL ( Table ),
        Table[Year]
            = SELECTEDVALUE ( Table[Year] ) - 1
            && Table[Week] = SELECTEDVALUE ( Table[Week] )
    )
)

2.png

Regards,

Cherie

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

@v-cherch-msft How do I remove the ALL function as this is hindering my filtering?

Hi @Anonymous

 

I would suggest you create a new thread on forum so that more community members can see it and provide advice. Please remember to post dummy data and desired result.

 

Regards,

Cherie

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

If I was to turn this into a matrix and add a column to the table how can I do this? Because we are using the ALL function is it just giving a total in all columns rather than filtering it

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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