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

Measure using CALCULATE not working

I'm trying to create a measure to calculate revenue (SubGrossAgencyTotRev) for the same week last fiscal year. MaxDate is the week-ending date. I added two columns to our date table: FiscalWeekYear & FiscalPYWeekYear. Here is the measure:

PY WTD =
    VAR WENo = LOOKUPVALUE('dim CalendarDate'[FiscalPYWeekYear],
    'dim CalendarDate'[CalendarDateKey],[MaxDate])
    VAR Result =
    CALCULATE(
        [SubGrossAgencyTotRev],
        'dim CalendarDate'[FiscalWeekYear]= WENo
    )
    RETURN Result
 
Unfortunately, the result is (Blank). Is it something with the way I've created the measure?
2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@Anonymous It's really difficult to say but CALCULATE can return wonky results sometimes. Perhaps if you post sample data and the formula for your measure can be more specific.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks for your reply and the video, Greg. I tried switching to using SUMX instead:

PY WTDv2 =
    VAR WENo = LOOKUPVALUE('dim CalendarDate'[FiscalWeekOfYearNumber],
    'dim CalendarDate'[CalendarDateKey],[MaxDate])
    VAR YrNo = LOOKUPVALUE('dim CalendarDate'[FiscalYearNumber],
    'dim CalendarDate'[CalendarDateKey],[MaxDate]) - 1
    VAR Result =
    SUMX(FILTER('dim CalendarDate','dim CalendarDate'[FiscalWeekOfYearNumber]=WENo && 'dim CalendarDate'[FiscalYearNumber] = YrNo),[SubGrossAgencyTotRev])
    RETURN Result
 
It's still doing the same thing. It's a ton of data, so I'm not really sure how to share it. I feel like the problem might be related to the YrNo variable. However, I created measures exactly the same way I defined the variables to see if maybe that was the issue. When I look at them, it looks right. So, I think the variables are defined correctly. Also, when I filter all my visuals using the fiscal week number and fiscal year defined in the variables, there is data. So that's not the issue either.  I'm not sure what else to try.



Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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