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
NeilAm12
Frequent Visitor

Additional Column for Previous Data Based on Previous Time and Filter

Hello All,

 

Need your help, i need to get the previous data of Data-Xi column base on Entry Date/Time based with filter of MiniCompany and Machine #.

I tried many formula but it shows error.

Concatenate: manual created column.

RRA Formula :

RRA = CALCULATE(MAX(DB[Data-Xi]),ALL(DBB),DBB[Concatenate] = EARLIER(DBB[Concatenate]), DB[Entry Date/Time] = EARLIER(DBB[Entry Date/Time]))

 

Below is my data without filter of concatenate:

Pics.PNG

 

Filter od concatenate:

My RRA data shows the same value in Data-Xi column not the previous data based on concatenate filter.

Pics 2.PNG

I rank manualy in excel the entry date/time. RRA 1st data shoul be show blank and the rest is based on previous data if you filter concatenate(Mini Company and Machine).

I need the correct formula of RRA.

Expected data:

Lot IDMini CompanyEntry Date/TimeMachine#Data-XiConcatenateRRA
63500DIEBOND_BONDFORCE_BS5/1/2019 7:20MRSI 1139.84DIEBOND_BONDFORCE_BSMRSI 11 
63600DIEBOND_BONDFORCE_BS5/1/2019 15:03MRSI 1137.98DIEBOND_BONDFORCE_BSMRSI 1139.84
63700DIEBOND_BONDFORCE_BS5/1/2019 23:04MRSI 1140.05DIEBOND_BONDFORCE_BSMRSI 1137.98
24700DIEBOND_BONDFORCE_BS5/2/2019 7:00MRSI 1139.1DIEBOND_BONDFORCE_BSMRSI 1140.05
24700DIEBOND_BONDFORCE_BS5/2/2019 19:02MRSI 1138.6DIEBOND_BONDFORCE_BSMRSI 1139.1
24800DIEBOND_BONDFORCE_BS5/3/2019 0:19MRSI 1139.77DIEBOND_BONDFORCE_BSMRSI 1138.6
24800DIEBOND_BONDFORCE_BS5/3/2019 15:01MRSI 1138.64DIEBOND_BONDFORCE_BSMRSI 1139.77
24800DIEBOND_BONDFORCE_BS5/3/2019 7:00MRSI 1141.123DIEBOND_BONDFORCE_BSMRSI 1138.64
343800DIEBOND_BONDFORCE_BS5/4/2019 3:09MRSI 1139.44DIEBOND_BONDFORCE_BSMRSI 1141.123
343900DIEBOND_BONDFORCE_BS5/4/2019 7:20MRSI 1139.69DIEBOND_BONDFORCE_BSMRSI 1139.44
344000DIEBOND_BONDFORCE_BS5/4/2019 15:46MRSI 1137.36DIEBOND_BONDFORCE_BSMRSI 1139.69
344000DIEBOND_BONDFORCE_BS5/4/2019 22:46MRSI 1138.92DIEBOND_BONDFORCE_BSMRSI 1137.36
394900DIEBOND_BONDFORCE_BS5/5/2019 7:04MRSI 1139.23DIEBOND_BONDFORCE_BSMRSI 1138.92
395000DIEBOND_BONDFORCE_BS5/5/2019 15:18MRSI 1140.97DIEBOND_BONDFORCE_BSMRSI 1139.23
395100DIEBOND_BONDFORCE_BS5/5/2019 22:58MRSI 1138.48DIEBOND_BONDFORCE_BSMRSI 1140.97

 

Thanks,

Neil

1 ACCEPTED SOLUTION

Hi,

I think this error is occuring because there is a duplication combination of Mini Company, Entry Date/Time and Machine#.  For the LOOKUPVALUE() function to work, each row combination should be unique

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=LOOKUPVALUE(Data[Data-Xi],Data[Mini Company],Data[Mini Company],Data[Machine#],Data[Machine#],Data[Entry Date/Time],CALCULATE(MAX(Data[Entry Date/Time]),FILTER(Data,Data[Mini Company]=EARLIER(Data[Mini Company])&&Data[Machine#]=EARLIER(Data[Machine#])&&Data[Entry Date/Time]<EARLIER(Data[Entry Date/Time]))))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello Ashish,

 

I tried the formula but it shows error, btw my entry/date time is not in chronoloical order i tried to sort it but i think PBI follows only in the 1 number.

 

RRA2 = LOOKUPVALUE(DBB[Data-Xi],DBB[Mini Company],DBB[Mini Company],DBB[Machine#],DBB[Machine#],DBB[Entry Date/Time],CALCULATE(MAX(DBB[Entry Date/Time]),FILTER(DBB,DBB[Mini Company]=EARLIER(DBB[Mini Company])&&DBB[Machine#]=EARLIER(DBB[Machine#])&&DBB[Entry Date/Time]<EARLIER(DBB[Entry Date/Time]))))

 

Pics3.PNG

Thanks for the help.

 

Regards,

Neil

Hi,

The formula definitely works (as evident from my screenshot).  Share the link from where i can download your PBI file.  Ensure that there are no errors in any cell of the columns which are being referred to in my formula.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello,

 

I cant attach my PBI file here. Can you share your mail to me so i will mail you my PBI file.

 

Regards,

Neil

Hi @NeilAm12 ,

 

You could upload your sample PBIX file onto OneDrive and share the downloaded link here. Remember to hide sensitive data in file.

 

Best regards,

Yuliana Gu

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

Hello,

 

Please see below link.

I don't know if you can access it, this is my 1st time to use OneDrive.

 

Regards,

Neil

Hi,

That requires signing in.  Try to share the file via Google Drive.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

I think this error is occuring because there is a duplication combination of Mini Company, Entry Date/Time and Machine#.  For the LOOKUPVALUE() function to work, each row combination should be unique

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.