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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Matrix Visual

Hi there,

 

I have a Matrix Displaying Products in the rows, week (formatted as text eg. "W02 2020") which comes from a table called date.

 

I would now like to calculate the difference between the most current week and the week before that and only insert it once (after the column containing the data of the current week)

I do can calculate the difference between two weeks bu the matrix visual always insertes a delta column after each week (see below)

 

Prodcutw 52 2019delta w 52 to w 51w 01 2020delta w01 to w 52w 02 2020delta w02 to w 01
x5172114
y10211110-1

 

Is there a way to use the matrix visual and flexible hide the delta columns that are not based on the two most current weeks in the data set so that the matrix looks like this:

 

Productw 52 2019w 01 2020w 02 2020delta w 02 to w 01
x5711+4
y101110-1
3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

How about adding filters? You can add filters manually or using the FILTER function.

 

Best regards,
Lionel Chen

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

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can try this pattern.

Previous Week = 
VAR __week = SELECTEDVALUE( 'Calendar'[yearWeekNo] ) -- format is number YYYYWW 202001
VAR __previousWeek =
    CALCULATE(
        MAX( 'Calendar'[Year Week] ),
        ALL( 'Calendar' ),
        'Calendar'[yearWeekNo] < __week
    )
RETURN 
CALCULATE(
    [Sales],
    ALL( 'Calendar' ),
    'Calendar'[Year Week] = __previousWeek
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Hi @Mariusz 

 

 would you expect the outcome of your formula is in my matrix? Do I sue the meausre as a column in my matrix?

Calendar Year Week in my model is currently a text in the format e.g. "W 01 2020"

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.