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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Padagon
Frequent Visitor

Visualize Current and Previous Week in cards

This might have been solved, I have tried some solutions however I haven't achieved what I need.

 

So the situation is this, I have a table like this:

 

idarticleevaluation_resultsdate
1a7.35-ago-24
2b8.14-ago-24
3c0.35-ago-24
4d4.56-ago-24
5a1.229-jul-24
6b0.930-jul-24
7c2.329-jul-24
8d6.72-ago-24

 

So, this is just a sample of what I have.

 

What I need to have is a card that shows the values from the latest week, and a second card to show the results from the week before. I can visualize the latest one, but haven't achieved to do it for the previous one.

 

So, I have the card to visualize the results for a, b, c, d, or combined (by using filters for article)

But haven't achieved to see them for the week between 29-jul and august 3.

I have already tried by creating a calendar table, and create the relationship with the date in my results table. I think my problem is in my DAX formula

 

Previous week = calculate([Total], datesbetween( calendar[date], min(calendar[date]) - 7, min(calendar[date)))

And then added that measure to the card visual

 

I have tried this:

 

Last Week =
VAR CurrentWeek = WEEKNUM(TODAY(), 21)
VAR CurrentYear = YEAR(TODAY())
VAR PreviousWeek = IF(CurrentWeek = 1, CALCULATE(MAX('Table'[Week]), ALL('Table'), 'Table'[Year] = CurrentYear - 1), CurrentWeek - 1)
VAR PreviousYear = IF(CurrentWeek = 1, CurrentYear - 1, CurrentYear)
RETURN
SUMX(
    FILTER(
        ALL('Table'),
        'Table'[Week] = PreviousWeek && 'Table'[Year] = PreviousYear
    ),
    [Total Evaluation]
)

 

It's been able to calculate the whole SUM for all the articles in the previous week, between 29-jul and august 3 in this case

However, when I add a Slicer (Tile) to select the article, I should get the SUM just for that article, but that is not happening and still gives me the SUM for the whole week. In resume, the slicer is not working properly.

 

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Padagon ,

Based on my testing, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1724137228603.png

2.Create the measure to calculate the previous week.

Previous week = 
CALCULATE(
    SUM('Table'[evaluation_results]),
    FILTER(
        'Table',
        'Table'[date] >= MIN('Table'[date]) && 'Table'[date] <= MIN('Table'[date]) + 6
    )
)

3.Create the measure to calculate the current week.

Current week = 
CALCULATE(
    SUM('Table'[evaluation_results]),
    FILTER(
        'Table',
        'Table'[date] > MIN('Table'[date]) + 6 && 'Table'[date] <= TODAY()
    )
)

4.Drag the measures into the card visual.

vjiewumsft_1-1724137249096.png

5.Drag the article into the card visual. The result is shown below.

vjiewumsft_2-1724137294133.png

 

Best Regards,

Wisdom Wu

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
Anonymous
Not applicable

Hi @Padagon ,

Based on my testing, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1724137228603.png

2.Create the measure to calculate the previous week.

Previous week = 
CALCULATE(
    SUM('Table'[evaluation_results]),
    FILTER(
        'Table',
        'Table'[date] >= MIN('Table'[date]) && 'Table'[date] <= MIN('Table'[date]) + 6
    )
)

3.Create the measure to calculate the current week.

Current week = 
CALCULATE(
    SUM('Table'[evaluation_results]),
    FILTER(
        'Table',
        'Table'[date] > MIN('Table'[date]) + 6 && 'Table'[date] <= TODAY()
    )
)

4.Drag the measures into the card visual.

vjiewumsft_1-1724137249096.png

5.Drag the article into the card visual. The result is shown below.

vjiewumsft_2-1724137294133.png

 

Best Regards,

Wisdom Wu

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

audreygerred
Super User
Super User

Hi! Here is a link that should help with WoW: Week-related calculations – DAX Patterns





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.

Top Solution Authors
Top Kudoed Authors