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! Learn more

Reply
andybamber
Helper III
Helper III

Calculate Change from Previous Week Not Working

Hello All,

 

I have a small issue with my report.

 

What i am trying to show is the change in headcount from previous week. i found this dax measure and it works when a user selects a specific date:

 

Change from Previous WK =

 

VAR lastWeekAmount =

    CALCULATE (

        DISTINCTCOUNT( SNAP_DWH_RES_RESOURCE[resource_key] ),

        FILTER (

            ALL ( DATE_DIMENSION ),

            DATE_DIMENSION[Week of Year]

                = MIN ( DATE_DIMENSION[Week of Year] ) - 1

        )

    )

RETURN

     DISTINCTCOUNT( SNAP_DWH_RES_RESOURCE[resource_key] ) - lastWeekAmount

 

So if the user selects December 1 from the line chart the Headcount in the table changes to reflect correctly and the Change from Previous Week is calculated correctly... previous week was 763

 

pbi_chg.png

 

However, when no specific date is selected the table correctly shows the latest headcount of 767 but DOES NOT show the change from previous week which was 3 (if the user selects December 8 specifically it does work). I presume its because the measure cannot calculate as a specific date is not in focus... but i cant seem to overide...

 

pbi_no chg.png

 

So, how do i modify the measure (or even create another measure) which will correctly show latest headcount and change from previous week when a specific date isnt selected?

 

Thanks,

 

Andy

1 REPLY 1
lbendlin
Super User
Super User

use HASONEVALUE() , HASONEFILTER() or some of the other checks to figure out if the user has made a selection. If not, precompute the result based on the max date.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.