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

View all the Fabric Data Days sessions on demand. View schedule

Reply
nutdiablo
Frequent Visitor

Get data from Previous week with all values.

Dear All, Before I start, sorry for my English.
Here is my Data Source

nutdiablo_0-1755252237518.png

And I want to create a DAX to get SUM of revenue of the prevoius week with all Pack, QouteNum, and Team.
Here is my DAX

PreviousWeekREV = CALCULATE (SUM(Sheet1[Revenue]),FILTER(ALL(Sheet1), Sheet1[WeekNumber] = SELECTEDVALUE(Sheet1[WeekNumber]) - 1),VALUES(Sheet1[Pack])).

BUT when I select week 32, it only show Pack B and C since in week 32 there is no Pack A, even I did select "Show Items With No Data".
nutdiablo_1-1755252422613.png
nutdiablo_2-1755252476848.png


Is there a way to do this and how?
Thank you. 

 

1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hi @nutdiablo 

Could you please try the measures below:

Revenue = SUM ( Sheet1[Revenue] )
Previous Week Revenue =
VAR _prev = SELECTEDVALUE ( DimWeek[WeekNumber] ) - 1
RETURN
    CALCULATE ( [Revenue],
        REMOVEFILTERS ( DimWeek[WeekNumber] ),
        DimWeek[WeekNumber] = _prev
    )

 

Create formatting measures:

Revenue (0) := COALESCE ( [Revenue], 0 )
Prev Week (0) := COALESCE ( [Previous Week Revenue], 0 )

 

Data :

rohit1991_2-1755257710160.png

 

 

Outcome :

image.png

 

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

2 REPLIES 2
rohit1991
Super User
Super User

Hi @nutdiablo 

Could you please try the measures below:

Revenue = SUM ( Sheet1[Revenue] )
Previous Week Revenue =
VAR _prev = SELECTEDVALUE ( DimWeek[WeekNumber] ) - 1
RETURN
    CALCULATE ( [Revenue],
        REMOVEFILTERS ( DimWeek[WeekNumber] ),
        DimWeek[WeekNumber] = _prev
    )

 

Create formatting measures:

Revenue (0) := COALESCE ( [Revenue], 0 )
Prev Week (0) := COALESCE ( [Previous Week Revenue], 0 )

 

Data :

rohit1991_2-1755257710160.png

 

 

Outcome :

image.png

 

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

It work! Thank you very much.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.