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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
cyncyn_98
Frequent Visitor

Dax Measure : Column Previous Values

Hello everyone, 

 

I'm having a bit of trouble formulating the right dax measure. I have created a matrix table, that will show data based on a week ending date selected. And within the matrix table, I want to have columns that will show previous week's values. 

I have used the dax measure below, but I get a column with totals, instead of the total by Branch Type. The total value is correct, I just need the column to show the right values by branch type. 

 

Prev Hours = CALCULATE(
    sum('Branch Flash Report'[TempHrs]),
    FILTER(ALL('Branch Flash Report'),'Branch Flash Report'[WeekID] = MAX('Branch Flash Report'[WeekID])-1))

 

cyncyn_98_0-1660678719872.png

Thank you!

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@cyncyn_98 

Please try it this way:

Prev Hours =
VAR __WEEKID =
    MAX ( 'Branch Flash Report'[WeekID] )
RETURN
    CALCULATE (
        SUM ( 'Branch Flash Report'[TempHrs] ),
        'Branch Flash Report'[WeekID] = __WEEKID - 1,
        REMOVEFILTERS ( 'Branch Flash Report'[WeekID] )
    )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@cyncyn_98 

Please try it this way:

Prev Hours =
VAR __WEEKID =
    MAX ( 'Branch Flash Report'[WeekID] )
RETURN
    CALCULATE (
        SUM ( 'Branch Flash Report'[TempHrs] ),
        'Branch Flash Report'[WeekID] = __WEEKID - 1,
        REMOVEFILTERS ( 'Branch Flash Report'[WeekID] )
    )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thank you @Fowmy ! That worked 😊

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.