Forum Discussion
krishnavzm
3 years agoFrequent Visitor
Date column comparison based on Quarter
Hi All, I'm new to PowerBI. I'm trying to compare two date coumns with Quarter no's. Please see the below table. I got the input as Actual Arrival Date and Expected Arrival Date. Then i can get t...
- 3 years ago
Hi, krishnavzm
You can try the following methods.
Column:Actual YQ = YEAR([Actual Arrival Date])&FORMAT([Actual Arrival Date],"q")Expected YQ = YEAR([Expected Arrival Date])&FORMAT([Expected Arrival Date],"q")Change the data format of the two columns from text to number.
Measure:
Flag = SWITCH(TRUE(), SELECTEDVALUE('Table'[Actual YQ])=SELECTEDVALUE('Table'[Expected YQ]),1, SELECTEDVALUE('Table'[Actual YQ])>SELECTEDVALUE('Table'[Expected YQ]),2, 3)Color = SWITCH(TRUE(), [Flag]=1,"Green", [Flag]=2,"Red", [Flag]=3,"Dark Green")Result:
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-zhangti
Community Support
3 years agoHi, krishnavzm
You can try the following methods.
Column:
Actual YQ = YEAR([Actual Arrival Date])&FORMAT([Actual Arrival Date],"q")Expected YQ = YEAR([Expected Arrival Date])&FORMAT([Expected Arrival Date],"q")
Change the data format of the two columns from text to number.
Measure:
Flag = SWITCH(TRUE(),
SELECTEDVALUE('Table'[Actual YQ])=SELECTEDVALUE('Table'[Expected YQ]),1,
SELECTEDVALUE('Table'[Actual YQ])>SELECTEDVALUE('Table'[Expected YQ]),2,
3)
Color = SWITCH(TRUE(),
[Flag]=1,"Green",
[Flag]=2,"Red",
[Flag]=3,"Dark Green")
Result:
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.