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

Return values without the last date in data

Hi guys, need help here

 

My last date of data is not today. 

nicholaskong_0-1602061820335.png

I have a slicer that is after x date to the latest production date. However, In my values I do not wish to display (it is showing a large dip at the end because the data is incomplete mid-day)

nicholaskong_0-1602062161435.png

 

I am trying to find the difference between the dates after, and the selected date, while excluding the most recent date.

This is my formula without excluding the most recent date - which is not today() but a date from the data source

DeltaProduction = SUM(table[production]) - CALCULATE(SUM(table[production]), FIRSTDATE(ALLSELECTED(Table[productionDate])))

 

3 REPLIES 3
v-eqin-msft
Community Support
Community Support

Hello @nicholaskong ,

In my opinion, in order to avoid a big fall, you want to sum the production after the selected date and calculate the difference between the selected one and the sum, right?

You can use the following formula:

DeltaProduction =
VAR _total =
    CALCULATE (
        SUM ( 'Table'[Production] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[ProductionDate] > MIN ( 'forSlicer'[ProductionDate] )
                && 'Table'[ProductionDate] < MAX ( 'forSlicer'[ProductionDate] )
        )
    )
RETURN
    IF (
        MAX ( 'Table'[ProductionDate] ) < MIN ( forSlicer[ProductionDate] ),
        SUM ( 'Table'[Production] ) - _total,
        0
    )

10.14.1.PNG

Here is the mypbix file.

Have I answered your question? Please mark my answer as a solution. Thanks a lot.
If not, load some insensitive data samples and expected output.

Best regards
Eyelyn Qin

amitchandak
Super User
Super User

@Anonymous , You can try a new measure like

 

new measure =
var _max =maxx(allselected(date), Date[date])
return
calculate([measure], filter(Date, Date[date] <_max))

Anonymous
Not applicable

@amitchandak 

nicholaskong_0-1602064306552.png


Graph comes out bad 😕

 

DeltaProduction = SUM(Genscape_HFOPM[Production]) - CALCULATE(sum(Genscape_HFOPM[Production]), FIRSTDATE(ALLSELECTED(Genscape_HFOPM[ProductionDate])))

DeltaWOMostRecent =
VAR Maximum = MAXX(ALLSELECTED(Genscape_HFOPM), Genscape_HFOPM[ProductionDate])
Return
CALCULATE([DeltaProduction], FILTER(Genscape_HFOPM, Genscape_HFOPM[ProductionDate]< Maximum))



 

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.