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
hwoehler
Helper I
Helper I

get previous values per group

Hello everybody,
I would like to have the previous values ​​(see screenshot) displayed for the "ChangeWeek" column. So there should be a new column (see screenshot "new"), where the previous value per group (ISIN) is always displayed. It is important that it is a column, not a measure. I already got a solution in another post (https://community.powerbi.com/t5/Desktop/Get-weekly-values-and-previous-values/m-p/927847/highlight/...), but it's a measure there and not a column. Does anyone have a solution?

 

PBI File: https://we.tl/t-wYhdl5R56e
Best regards, hwoehler
screenshotscreenshot (Screenshot)

1 ACCEPTED SOLUTION

Try , as new columns

Column = maxx(filter('Table','Table'[ISIN]=EARLIER('Table'[ISIN]) && not(ISBLANK('Table'[ChangeWeek])) && 'Table'[Date]<EARLIER('Table'[Date])),'Table'[Date])

Column 2 = if(ISBLANK('Table'[ChangeWeek]),BLANK(),maxx(FILTER('Table','Table'[ISIN]=EARLIER('Table'[ISIN]) && ('Table'[Date])=EARLIER('Table'[Column])),('Table'[ChangeWeek])))

 https://www.dropbox.com/s/kexca62xapy8j41/Filter2.pbix?dl=0

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@hwoehler , can ypu let us know the logic of last column. Not very clear from the example

Hi @amitchandak ,

you're right. The screenshot is misleading. This screenshot should be better:
desired column "new"desired column "new"The column "new" consists of (always) the previous value. (based on column "ChangeWeek".
Best regards, hwoehler

Try , as new columns

Column = maxx(filter('Table','Table'[ISIN]=EARLIER('Table'[ISIN]) && not(ISBLANK('Table'[ChangeWeek])) && 'Table'[Date]<EARLIER('Table'[Date])),'Table'[Date])

Column 2 = if(ISBLANK('Table'[ChangeWeek]),BLANK(),maxx(FILTER('Table','Table'[ISIN]=EARLIER('Table'[ISIN]) && ('Table'[Date])=EARLIER('Table'[Column])),('Table'[ChangeWeek])))

 https://www.dropbox.com/s/kexca62xapy8j41/Filter2.pbix?dl=0

Yep, EARLIER.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

So generally you are going to do this with something like EARLIER - See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395.... What is the measure calculation that fixed it? Should be very translatable to a column.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.