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.
New to DAX and its language.
I am trying to make a measure that gives feedback if a date from one column is greater than a date in another column. This is for multiple projects that are using the same base template with different dates for each. So duplicate columns are expected.
I tried this formula:
IsNetworkReadyOnTrackforUAT = IF(LOOKUPVALUE(Tasks[TaskFinishDate],Tasks[ShortTaskName],"NETWORK READY") > LOOKUPVALUE(Tasks[TaskFinishDate],Tasks[ShortTaskName],"UAT"), "IN TROUBLE","ALL GOOD")
this produces an error of multiple values. In researching, I tried using calculate with FIRSTNONBLANK like this:
IsNetworkReadyOnTrackforUAT = IF(
CALCULATE(
FIRSTNONBLANK(Tasks[TaskFinishDate], 1),
FILTER(ALL(Tasks),Tasks[ShortTaskName] = "UAT")
)
>
CALCULATE(
FIRSTNONBLANK(Tasks[TaskFinishDate], 1),
FILTER(ALL(Tasks),Tasks[ShortTaskName] = "NETWORK READY")
),
"IN TROUBLE",
"ALL GOOD")
This returns the same value for all of the rows (each row has a different value). Here is a snapshot of the data.
I think I'm missing something basic but unsure.
your sample data doesn't match your description. It is unclear if you are trying to look up something in the same table or another table (LOOKUPVALUE is usually used for the latter). Please elaborate.
No, all the data is contained within the same table.
Here is a summary of what I'm looking to do:
For each PROJECT NAME, find the TASK NAME called "UAT" and select the START date. For each PROJECT NAME, find the TASK NAME called "NETWORK READY" and select the START date. Comp[are these two START dates. If the START date for UAT is greater than the START date for "NETWORK READY", output "GOOD". Else, output "BAD".
I've highlighted two example columns out of my data.
The output here in this case should be GOOD.
TIA
@tlh , below is formula, i added a condition: if we are missing data for either uat or network days return "no compare".
Result =
VAR _UatStart =
LOOKUPVALUE (
Tasks[Start],
Tasks[Task Name], "UAT",
Tasks[Project Name], Tasks[Project Name]
)
VAR _NetworkStart =
LOOKUPVALUE (
Tasks[Start],
Tasks[Task Name], "NETWORK READY",
Tasks[Project Name], Tasks[Project Name]
)
RETURN
IF (
Tasks[Task Name] IN { "UAT", "NETWORK READY" },
IF (
AND ( NOT ( ISBLANK ( _NetworkStart ) ), NOT ( ISBLANK ( _UatStart ) ) ),
IF ( _NetworkStart > _UatStart, "IN TROUBLE", "ALL GOOD" ),
"NO COMPARE"
)
)
What is your plan for scenarios when either of the entries is missing or duplicated?
Thanks for your help, but still not working. Here is what I'm doing. I duplicated the data into a table called TestTable and updated your formula.
No plans for that yet. It should never happen as they are a part of the template used.
@tlh there are fields underlined with red line, it means that there is no such field in your table/model. Check these and make sure you type it correctly.
Another thing, if there are no underlined fields and you get error that it cant get single value (as on screenshot) it means that there is still column in table which we need to add in lookup as on current lookup parameters dax cant find unique value.
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 |
---|---|
56 | |
27 | |
24 | |
14 | |
9 |
User | Count |
---|---|
77 | |
61 | |
47 | |
17 | |
12 |