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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
selpaqm
Helper V
Helper V

Find previous manufacturer

Hi,

 

having a table as summarized below. 

Supplieritemshipment dateUniqueDesired Result
aaaa1111101/08/2023aaaa-11111First Supplier
bbbb2222203/08/2023bbbb-22222First Supplier
cccc1111103/08/2023cccc-11111aaaa (Note: because aaaa produced 1111 at 01/08
dddd3333304/08/2023dddd-33333First Supplier
eeee2222205/08/2023eeee-22222bbbb
fffff1111106/08/2023fffff-11111cccc (first supplier is aaaa but previous supplier is ccccc)
ggggg3333307/08/2023ggggg-33333dddd
cccc1111103/08/2023cccc-11111aaaa
cccc1111105/08/2023cccc-11111aaaa
cccc1111102/08/2023cccc-11111aaaa

 

in the table, I added a calculated column to find if the supplier for the item is changed. it adds yes or no. however, my manager want to see previous supplier as well as new supplier and I could not able to add it. 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

Is this what you are looking for?

 

Column = 
VAR _MinDate = CALCULATE(MIN('Table'[shipment date]),ALLEXCEPT('Table','Table'[item]))
VAR _items = CALCULATE(MIN('Table'[upplier]),ALLEXCEPT('Table','Table'[item]),'Table'[shipment date]=_MinDate)

RETURN
IF(_items =[upplier],"First Supplier",_items)

 

 

Screenshot_1.png

View solution in original post

6 REPLIES 6
Ahmedx
Super User
Super User

Is this what you are looking for?

 

Column = 
VAR _MinDate = CALCULATE(MIN('Table'[shipment date]),ALLEXCEPT('Table','Table'[item]))
VAR _items = CALCULATE(MIN('Table'[upplier]),ALLEXCEPT('Table','Table'[item]),'Table'[shipment date]=_MinDate)

RETURN
IF(_items =[upplier],"First Supplier",_items)

 

 

Screenshot_1.png

Semaj06
Regular Visitor

Previous supplier =
VAR datepivot = Feuil1[shipment date]

var result=
    IF (
        CALCULATE (
            COUNTROWS ( Feuil1 ),
            Feuil1[shipment date] < datepivot,
            ALLEXCEPT ( Feuil1, Feuil1[item] )
        ) = 0,
        "First supplier",
        CALCULATE (
            MAX ( Feuil1[Supplier] ),
            Feuil1[shipment date] <EARLIER(Feuil1[shipment date]),
            ALLEXCEPT ( Feuil1, Feuil1[item] )
        )
    )
return
result
Semaj06
Regular Visitor

HI Try this

Semaj06_0-1692609370313.png

Previous supplier =
VAR datepivot = Feuil1[shipment date]
RETURN
IF (
CALCULATE (
COUNTROWS ( Feuil1 ),
Feuil1[shipment date] < datepivot,
ALLEXCEPT ( Feuil1, Feuil1[item] )
) = 0,
"First send",
CALCULATE (
MAX ( Feuil1[Supplier] ),
Feuil1[shipment date] < datepivot,
ALLEXCEPT ( Feuil1, Feuil1[item] )
)
)

Hi @Semaj06 ,

thanks for your respond however it is not fit all of the data in the column is first send in my column.

 

Ritaf1983
Super User
Super User

Hi @selpaqm 
What do you mean by the previous supplier?
Can you show what is the desired result?

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi @Ritaf1983 ,

 

thanks for your respond. I have amended table. can you please check and advise?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.