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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gracechong
Helper I
Helper I

Calculate amount diff from 2 different fields; based on 2 different run dates from the same column

Hi,

I have a Power BI Matrix below which I am comparing "Current Score" from the current run date of 30 June; vs the "Previous Score" from the previous run date of 31 Dec. These respective run dates are coming from the same RUN DATE column. It is just that both of them are generated using a date slicer. 

As you can see in Variance Score below, it seems to be variance from current score and previous score of the same run date; instead of comparing current score from 30 June 2021 to previous score from 31 Dec 2019.

gracechong_0-1624566683228.png

 

I have intially thought it is due to HASONEFILTER but it doesn't seem so. Any idea what could be the error here?
Below is the formula I've used:

Variance Score =

VAR CurrentScore =
SUM ( Scorecard[Score] )

VAR PreviousScore = CALCULATE([Score],ALL('Current date'),DATEADD('Current Date'[RUN DATE],[Date Diff],DAY))

RETURN

IF(HASONEFILTER(Scorecard[RUN DATE]),CurrentScore - PreviousScore,"X")

 

1 REPLY 1
lbendlin
Super User
Super User

@gracechong Please provide sample data in usable format (not as a picture - maybe insert into a table?) and show the expected outcome.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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