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
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
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.