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.
State | Date | Cases |
Alabama | 1/1/2020 | 1 |
Alabama | 1/2/2020 | 2 |
Alabama | 1/3/2020 | 3 |
Alabama | 1/4/2020 | 4 |
Alabama | 1/5/2020 | 5 |
Alaska | 1/1/2020 | 1 |
Alaska | 1/2/2020 | 2 |
Alaska | 1/3/2020 | 3 |
Alaska | 1/4/2020 | 4 |
Above is a sample dataset. I'm trying to create a new column that evaluates Alabama and output OPEN if the Date is between 1/2/2020 and 1/4/2020. Otherwise, output CLOSED as the result.
I tried adding a Quick Measure with a nested IF and DATESBETWEEN statement but it didn't work. It prints CLOSED for all of Alabama.
NewColumn = if('MyTable'[State] = "Alabama",if(DATESBETWEEN('MyTable'[Date],1/2/2020, 1/4/2020), "OPEN", "CLOSED"))
Any idea on how to get the result below?
State | Date | Cases | NewColumn |
Alabama | 1/1/2020 | 1 | CLOSED |
Alabama | 1/2/2020 | 2 | OPEN |
Alabama | 1/3/2020 | 3 | OPEN |
Alabama | 1/4/2020 | 4 | OPEN |
Alabama | 1/5/2020 | 5 | CLOSED |
Alaska | 1/1/2020 | 1 | |
Alaska | 1/2/2020 | 2 | |
Alaska | 1/3/2020 | 3 | |
Alaska | 1/4/2020 | 4 |
Solved! Go to Solution.
Hi @vinceluc22 ,
Try this code for a calculated column:
Hi @vinceluc22 ,
Try this code for a calculated column:
Thank You! Seems like the DATESBETWEEN statement wasn't needed.
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 |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |