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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Guyakobov
Helper II
Helper II

previous value

HI,

 

I would like to get the previous value.

so when I choose date 12.03.18 my profit will be -123960.45 and not -116778.37

http://prntscr.com/mtzgw5

 

Thanks 

8 REPLIES 8
PattemManohar
Community Champion
Community Champion

@Guyakobov  Please try this as a New Measure

 

Test231 = 
VAR _PrevMax = CALCULATE(MAX(Test231PrevValDynamic[Time]),FILTER(ALL(Test231PrevValDynamic),Test231PrevValDynamic[Time]<SELECTEDVALUE(Test231PrevValDynamic[Time])))
RETURN CALCULATE(FIRSTNONBLANK(Test231PrevValDynamic[Profit],0),Test231PrevValDynamic[Time] = _PrevMax)

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




HI,

 

i wrote the measure like this : 

floating pl is the table name.

 

Test231 =
VAR _PrevMax = CALCULATE(MAX('floating pl'[Time]),FILTER(ALL('floating pl'),'floating pl'[Time]<SELECTEDVALUE('floating pl'[Time])))
RETURN CALCULATE(FIRSTNONBLANK('floating pl'[Profit],0),'floating pl'[Time] = _PrevMax)

 

 And my measure is null http://prntscr.com/mu15sc 

 

BTW, there is more than one Login account.

 

Thanks 

 

@Guyakobov  You are using date filter as range instead of list, as your requirement is to show the previous profit value based on the date selected. Also, use Login in your filter criteria if you want to include Login in the logic as below

 

Test231 = 
VAR _PrevMax = 
CALCULATE(MAX(Test231PrevValDynamic[Time]),FILTER(ALL(Test231PrevValDynamic),Test231PrevValDynamic[Time]<SELECTEDVALUE(Test231PrevValDynamic[Time]) && Test231PrevValDynamic[Login] = SELECTEDVALUE(Test231PrevValDynamic[Login]) ))
RETURN CALCULATE(FIRSTNONBLANK(Test231PrevValDynamic[Profit],0),Test231PrevValDynamic[Time] = _PrevMax)

image.pngimage.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Hi,

 

I want to use the slicer so the start date will show the previous value - im not gonna use the date picker.

 

I tried the new formula and still blank http://prntscr.com/mu2ifa 

 

Test231 =
VAR _PrevMax =
CALCULATE(MAX('floating pl'[Time]),FILTER(ALL('floating pl'),'floating pl'[Time]<SELECTEDVALUE('floating pl'[Time]) && 'floating pl'[Login] = SELECTEDVALUE('floating pl'[Login]) ))
RETURN CALCULATE(FIRSTNONBLANK('floating pl'[Profit],0),'floating pl'[Time] = _PrevMax)

 

 

Hi @Guyakobov ,

 

You should select Login too. Or SELECTEDVALUE('floating pl'[Login])  is blank. Please give it a try.

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI,

 

still doesn't work, I want a column that will give me the previous row with separation from each account.

 

http://prntscr.com/mulbdm

 

Thanks 

Hi @Guyakobov ,

 

Could you please mark the proper answers as solutions?

 

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Guyakobov ,

 

You mean you need a calculated column. If so, you can't make it dynamic with a slicer. Please try out the formula below as a calculated column.

 

Previous =
VAR currentAccount = [account]
VAR currentTime = [time]
VAR previousDate =
    CALCULATE (
        MAX ( 'table'[time] ),
        FILTER (
            'table',
            'table'[account] = currentAccount
                && 'table'[time] < currenttime
        )
    )
RETURN
    CALCULATE (
        SUM ( 'table'[profit] ),
        FILTER (
            'table',
            'table'[account] = currentAccount
                && 'table'[time] = previousDate
        )
    )

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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