Forum Discussion
Return text from different column based on criteria
- 2 years ago
Hi mryoan04 - you can create a calculated column to fill the "Is Scraped on Invoice" column based on the "WO" transactions as:
Is Scraped on Invoice =
VAR CurrentProduct = 'Workforce'[Product]
VAR IsScrappedWO =
CALCULATE(
MAX('Workforce'[Is Scraped]),
FILTER(
'Workforce',
'Workforce'[Product] = CurrentProduct &&
'Workforce'[Transaction] = "WO" &&
'Workforce'[Is Scraped] = "Y"
)
)
RETURN
IF(
'Workforce'[Transaction] = "Invoice" &&
NOT ISBLANK(IsScrappedWO),
IsScrappedWO,
BLANK()
)To fill the "Scrap Reason on Invoice" column based on the "Work Order" transactions
Scrap Reason on Invoice =
VAR CurrentProduct = 'Workforce'[Product]
VAR ScrapReasonWO =
CALCULATE(
MAX('Workforce'[Scrap Reason]),
FILTER(
'Workforce',
'Workforce'[Product] = CurrentProduct &&
'Workforce'[Transaction] = "WO" &&
NOT ISBLANK('Workforce'[Scrap Reason])
)
)
RETURN
IF(
'Workforce'[Transaction] = "Invoice" &&
NOT ISBLANK(ScrapReasonWO),
ScrapReasonWO,
BLANK()
)this works. please check
Hi mryoan04 - you can create a calculated column to fill the "Is Scraped on Invoice" column based on the "WO" transactions as:
Is Scraped on Invoice =
VAR CurrentProduct = 'Workforce'[Product]
VAR IsScrappedWO =
CALCULATE(
MAX('Workforce'[Is Scraped]),
FILTER(
'Workforce',
'Workforce'[Product] = CurrentProduct &&
'Workforce'[Transaction] = "WO" &&
'Workforce'[Is Scraped] = "Y"
)
)
RETURN
IF(
'Workforce'[Transaction] = "Invoice" &&
NOT ISBLANK(IsScrappedWO),
IsScrappedWO,
BLANK()
)
To fill the "Scrap Reason on Invoice" column based on the "Work Order" transactions
Scrap Reason on Invoice =
VAR CurrentProduct = 'Workforce'[Product]
VAR ScrapReasonWO =
CALCULATE(
MAX('Workforce'[Scrap Reason]),
FILTER(
'Workforce',
'Workforce'[Product] = CurrentProduct &&
'Workforce'[Transaction] = "WO" &&
NOT ISBLANK('Workforce'[Scrap Reason])
)
)
RETURN
IF(
'Workforce'[Transaction] = "Invoice" &&
NOT ISBLANK(ScrapReasonWO),
ScrapReasonWO,
BLANK()
)
this works. please check
Thank you! It works!