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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Count function of previous date record

Hi,

 

I want to present the 'count of item number' of the previous report date and show the % difference. So for report date 06/12/2020 the record should be blank and for report date 13/12/2020 the new record should show 19, so that I am able to calculate the difference. In this case (14-19)/19 = -26%. What column based calculation and/or measure can I implement? I am working on direct query!

 

2020-12-17 12_01_44-Inventory_levels_Rev1 (UC) - Power BI Desktop.png

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Create a measure like so:

Measure =
VAR ThisDate =
    MAX ( 'Table'[Report Date] )
VAR PreDate =
    CALCULATE ( MAX ( 'Table'[Report Date] ), 'Table'[Report Date] < ThisDate )
VAR PreCount =
    CALCULATE ( COUNT ( 'Table'[Item Number] ), 'Table'[Report Date] = PreDate )
VAR ThisCount =
    COUNT ( 'Table'[Item Number] )
RETURN
    DIVIDE ( ThisCount - PreCount, PreCount )

count.JPG

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

View solution in original post

1 REPLY 1
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Create a measure like so:

Measure =
VAR ThisDate =
    MAX ( 'Table'[Report Date] )
VAR PreDate =
    CALCULATE ( MAX ( 'Table'[Report Date] ), 'Table'[Report Date] < ThisDate )
VAR PreCount =
    CALCULATE ( COUNT ( 'Table'[Item Number] ), 'Table'[Report Date] = PreDate )
VAR ThisCount =
    COUNT ( 'Table'[Item Number] )
RETURN
    DIVIDE ( ThisCount - PreCount, PreCount )

count.JPG

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.