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.
Hello,
I'm looking to create the realized column shown in the table below. It works off the following pseudo-code:
If "Trade Type" = "New Trade" and there is no "Full Unwind" for this ID and "Expiry Date" >= Today(), then "N".
Otherwise, "Y".
ID | Trade type | Realised | Today | Expirey Date |
1 | New Trade | Y | 01/11/2019 | 01/10/2020 |
1 | Full unwind | Y | 01/11/2019 | 02/10/2020 |
2 | New Trade | N | 01/11/2019 | 05/09/2020 |
3 | New Trade | Y | 01/11/2019 | 15/10/2018 |
4 | New Trade | Y | 01/11/2019 | 05/10/2020 |
4 | Full unwind | Y | 01/11/2019 | 06/10/2020 |
5 | New Trade | N | 01/11/2019 | 07/07/2020 |
6 | New Trade | Y | 01/11/2019 | 18/11/2020 |
6 | Full unwind | Y | 01/11/2019 | 18/11/2020 |
7 | New Trade | N | 01/11/2019 | 10/10/2021 |
8 | New Trade | N | 01/11/2019 | 11/08/2020 |
9 | New Trade | N | 01/11/2019 | 17/05/2020 |
10 | New Trade | Y | 01/11/2019 | 13/10/2019 |
How would I code this in Dax?
Many thanks in advance
Solved! Go to Solution.
@Anonymous
Please create a calculated column as per below code
Column =
VAR tt = CALCULATE(CONCATENATEX(Test,Test[Trade type]," "),ALLEXCEPT(Test,Test[ID]))
RETURN IF(AND(tt="New Trade",Test[Expirey Date]>=Test[Today]),"N","Y")
@Anonymous
Please create a calculated column as per below code
Column =
VAR tt = CALCULATE(CONCATENATEX(Test,Test[Trade type]," "),ALLEXCEPT(Test,Test[ID]))
RETURN IF(AND(tt="New Trade",Test[Expirey Date]>=Test[Today]),"N","Y")
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
51 | |
46 | |
39 | |
19 | |
19 |