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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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?

Hi @Ritaf1983 ,

 

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.