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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Syndicate_Admin
Administrator
Administrator

Help in creating a condition

Dear, good afternoon. I tell you that I am making a panel which measures the delivery behavior of my suppliers, so far I have advanced considerably, unless I run into a problem which I have not been able to solve. I have a calculated column which according to certain parameters gives me different conditions,

Delivery Status =
SWITCH( TRUE(),
(VW_EvaProData2[status] = "Approved" && VW_EvaProData2[Reception Status] = "Full Reception" && VW_EvaProData2[Scheduled] = "" && LASTDATE(VW_EvaProData2[Fecha_Comp]) >= LASTDATE(VW_EvaProRec[Fecha_R])), "On time",
(VW_EvaProData2[status] = "Approved" && VW_EvaProData2[Reception Status] = "Partial Reception" && VW_EvaProData2[Scheduled] = "" && LASTDATE(VW_EvaProData2[Fecha_Comp]) >= LASTDATE(VW_EvaProRec[Fecha_R])), "On time",
(VW_EvaProData2[status] = "Approved" && VW_EvaProData2[Reception Status] = "No reception" && VW_EvaProData2[Scheduled] = "" && LASTDATE(VW_EvaProData2[Fecha_Comp]) >= LASTDATE(VW_EvaProRec[Fecha_R])), "On time",
(VW_EvaProData2[status] = "Approved" && VW_EvaProData2[Scheduled] = "Scheduled"), "Scheduled",
(VW_EvaProData2[status] = "Approved" && LASTDATE(VW_EvaProData2[Fecha_Comp]) < LASTDATE(VW_EvaProRec[Fecha_R])) || VW_EvaProData2[Reception Status] = "Forced Reception", "Retrazada",
(VW_EvaProData2[status] = "Pending") && VW_EvaProData2[Fecha_Comp] >= TODAY(), "In Process",
VW_EvaProData2[status] = "Cancelled", "Cancelled")
The poblematica that is presented to me is that in some OC there are 2 types of states, which by definition I must leave them in a retraced state, if one of the lines of the document is in this state

RodriCP_0-1696967815899.png

My idea is that those marked states if one of the items of the document are retraced, I change all the states to retraced



2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Thank you very much for the answer, but I made a mistake with the code inserted. This is really the code

Delivery Status =
SWITCH( TRUE(),
(VW_EvaProData2[status] = "Approved" && VW_EvaProData2[Receiving Status] = "Reception Complete" && VW_EvaProData2[Scheduled] = "" && LASTDATE(VW_EvaProData2[Fecha_Comp]) >= LASTDATE(VW_EvaProRec[Fecha_R])), "On Time",
(VW_EvaProData2[status] = "Approved" && VW_EvaProData2[Receiving Status] = "Partial Reception" && VW_EvaProData2[Scheduled] = "" && LASTDATE(VW_EvaProData2[Fecha_Comp]) >= LASTDATE(VW_EvaProRec[Fecha_R])), "On Time",
(VW_EvaProData2[status] = "Approved" && VW_EvaProData2[Receiving Status] = "No Reception" && VW_EvaProData2[Scheduled] = "" && LASTDATE(VW_EvaProData2[Fecha_Comp]) >= LASTDATE(VW_EvaProRec[Fecha_R])), "On Time",
(VW_EvaProData2[status] = "Approved" && VW_EvaProData2[Scheduled] = "Scheduled"), "Scheduled",
(VW_EvaProData2[status] = "Approved" && LASTDATE(VW_EvaProData2[Fecha_Comp]) < LASTDATE(VW_EvaProRec[Fecha_R])) || VW_EvaProData2[Receiving State] = "Forced Reception", "Retrazada",
(VW_EvaProData2[status] = "pending") && VW_EvaProData2[Fecha_Comp] >= TODAY(), "In Progress",
VW_EvaProData2[status] = "Cancelled", "Cancelled")

What it requires is that, if one of the lines associated with the first column is in a backward state, I change all the states to delayed

RodriCP_0-1697024787780.png



amitchandak
Super User
Super User

@Syndicate_Admin , If this is calculated column not measure then you need to revisit these

 LASTDATE(VW_EvaProData2[Fecha_Comp]) >= LASTDATE(VW_EvaProRec[Fecha_R])

 

They should use related or relatedtable. or nothing if from same table

 

function in column will give value from entire table

In column that last date from complete column without filter

 

In measure that last day in context

 

 

refer 4 ways (related, relatedtable, lookupvalue, sumx/minx/maxx with filter) to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

 

 

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.