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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jennylouf
Regular Visitor

Previous Week Total has no values in my table visual

 

Hello everyone,

 

Appreciate your expertise in making my measures work.

 

Here’s the table named ds-collab:


Inquiry_CCCSymptom_CCCTopic CaseNumber CreatedDate
Rewards ProgramCustomer Account Reinstatement Requests Due to App Access IssuesCustomer Account Reinstatement Issues610582009/04/2024
Rewards ProgramCustomer Account Reinstatement Requests Due to App Access IssuesCustomer Account Reinstatement Requests Due to App Access Issues610247009/03/2024
Rewards ProgramCustomer Points Issues and ResolutionsCustomer Points Discrepancies610614209/05/2024
Rewards ProgramCustomer Points Issues and ResolutionsCustomer Rewards Program Inquiries and Phone Number Issues610602909/04/2024
Rewards ProgramSuspended Customer Accounts Due to FraudCustomer Account Lock Issues610334609/03/2024
Rewards ProgramSuspended Customer Accounts Due to FraudCustomer Account Suspension Due to Fraud610599009/04/2024
Mobile Payment AppCredit Card Linking Issues and AVS MismatchesAVS Mismatch Issues with Debit Card Linking610625709/05/2024
Mobile Payment AppCredit Card Linking Issues and AVS MismatchesTechron Advantage Card App Issues610475909/04/2024
Mobile Payment AppCustomer Issues with Linking eGC/Gift Cards Due to Active Card LimitsCustomer Issues with Linking eGC/Gift Cards Due to Active Card Limits610337309/03/2024
Mobile Payment AppCustomer Login Issues on New Phones Resolved by Reinstalling AppCustomer Login Issues on New Phone Resolved by Reinstalling App610615809/05/2024
Mobile Payment AppCustomer Login Issues on New Phones Resolved by Reinstalling AppPhone Number Update Requests610622109/05/2024
Mobile Payment AppCustomer Refund Requests for Gas ChargesCustomer Refund Requests for Gas Charges610647309/05/2024
Mobile Payment AppCustomer Refund Requests for Gas ChargesVenmo Payment Issues and Customer Support610594209/04/2024
Mobile Payment AppDaily Transaction Limit ExceededDaily Transaction Limit Exceeded610517109/04/2024
Mobile Payment AppGift Card Linking Issues Due to Active Card LimitsGift Card Linking Issues Due to Active Card Limits610568609/04/2024
Mobile Payment AppGift Card Linking Issues in AppEGC Linking Issues610599709/04/2024
Mobile Payment AppGift Card Linking Issues in AppGift Card Addition Issues610588409/04/2024
Mobile Payment AppHDA Velocity Error Retry InstructionseGC Velocity Linking Issues610322909/03/2024
Mobile Payment AppHDA Velocity Error Retry InstructionsHDA Velocity Error Retry Instructions597764507/03/2024
Mobile Payment AppLogin Error with Verification CodeCode Entry Error Messages609909209/01/2024
Mobile Payment AppLogin Error with Verification CodeLogin Issues Due to Verification Code Errors610577309/04/2024
Mobile Payment AppMobile Payment App IssuesMobile Payment App Issues610630109/05/2024
Mobile Payment AppMobile Payment App IssuesResponsible AI Policy - Flagged Descriptions610624109/05/2024
Mobile Payment AppMobile Payment Issues and SolutionsPayment Declination Issues610603409/04/2024
Mobile Payment AppMobile Payment Issues and SolutionsPayment Issues with App610628209/05/2024
Mobile Payment AppPayment Rate Limit ExceededPayment Rate Limit Exceeded610583309/04/2024
Mobile Payment AppPre-Authorization Hold Customer IssuesCustomer Inquiries on Failed Transactions and Refunds610601909/04/2024
Mobile Payment AppPre-Authorization Hold Customer IssuesGas Charge and Pre-Authorization Hold Issues610648109/05/2024

 

There are slicers for year (single select) and month (multi select) based on a "_Calendar" table. 

 

I created a measure for CurrentWeekTotal that should be based on the selected year and if month is not selected or all are selected it will give the current week total (as of the last CreatedDate), but if a month or multiple months is selected it will give the last week total as base for current.

 

These seems to work:

TotalCases = DISTINCTCOUNT('ds-collab'[_CaseNumber])
CurrentWeekTotal = 
VAR SelectedYear = SELECTEDVALUE('_Calendar'[Year])
VAR SelectedMonths = VALUES('_Calendar'[MonthNo])
VAR LastCreatedDate = MAX('ds-collab'[CreatedDate])
VAR CurrentWeek = WEEKNUM(LastCreatedDate, 2)
RETURN
IF( ISFILTERED('_Calendar'[Month]) && COUNTROWS(SelectedMonths) > 0,
    CALCULATE(
        [TotalCases],
        FILTER(
            'ds-collab',
            WEEKNUM('ds-collab'[CreatedDate], 2) = CurrentWeek &&
            YEAR('ds-collab'[CreatedDate]) = SelectedYear &&
            MONTH('ds-collab'[CreatedDate]) IN SelectedMonths )),
    CALCULATE(
        [TotalCases],
        FILTER(
            'ds-collab',
            WEEKNUM('ds-collab'[CreatedDate], 2) = CurrentWeek &&
            YEAR('ds-collab'[CreatedDate]) = SelectedYear )))

Now, I need to create the next measures, but cannot proceed as I'm getting blank values in my table for the PreviousWeekTotal.

  1. previous week total is one week prior the CurrentWeekTotal
  2. variance % of current week and previous week total
  3. average weekly total
  4. average previous weekly total is one week prior the average weekly total
  5. variance % of average weekly total and average previous weekly total

Can I have the measures for the remaining 5?  

Here's what I did for the PreviousWeekTotal that gives me blank values in my table visual.

PreviousWeekTotal = 
VAR SelectedYear = SELECTEDVALUE('_Calendar'[Year])
VAR SelectedMonths = VALUES('_Calendar'[MonthNo])
VAR LastCreatedDate = MAX('ds-collab'[CreatedDate])
VAR CurrentWeek = WEEKNUM(LastCreatedDate, 2)
VAR PreviousWeek = CurrentWeek - 1
RETURN
IF( ISFILTERED('_Calendar'[Month]) && COUNTROWS(SelectedMonths) > 0,
    CALCULATE(
        [TotalCases],
        FILTER(
            'ds-collab',
            WEEKNUM('ds-collab'[CreatedDate], 2) = PreviousWeek &&
            YEAR('ds-collab'[CreatedDate]) = SelectedYear &&
            MONTH('ds-collab'[CreatedDate]) IN SelectedMonths )),
    CALCULATE(
        [TotalCases],
        FILTER(
            'ds-collab',
            WEEKNUM('ds-collab'[CreatedDate], 2) = PreviousWeek &&
            YEAR('ds-collab'[CreatedDate]) = SelectedYear )))

Appreciate your input.  Thanks for your time.

 

 

1 REPLY 1
lbendlin
Super User
Super User

VAR PreviousWeek = CurrentWeek - 1

That will not work when you are in week 1 of a year.

 

Instead, use DATEADD(<calendar date>,-7,DAY) 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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