The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello,
There is a measure that calculates the days between two dates.
I have an IF column that I implement for this result. But it's not working properly. I have indicated in the picture the ones that do not work properly. How can I fix?
Hello @selimovd
Thank you for help.
I already wrote that I used it this way in the first message. But it doesn't work properly that way. Unfortunately my problem is not solved 😞
Hey @Anonymous ,
yes, but your description is not very detailed, so it's kind of hard to find out why there is the error.
Can you share the file? It's easier to take a look at the problem.
Thank you and best regards
Denis
Hey @Anonymous ,
is the [Status] a calculated column or a measure?
Be aware that calculated columns are static, so they will not change the value depending on the filter context. Once the table is loaded the value stays the same.
Measures are dynamic, so depending on the filter context the value will change with every change of the data (change of rows, slicer, etc.)
Hello @selimovd
Thank you for reply.
Status is column. When I change it to Measure, the table gets corrupted. Is there a way to build from scratch what I want to do? I want to find the number of days between "DocumentDate" date and "Belgetrh". And I want it to write NOT ok if the result is less than 0, OK if it is greater than 0.
Thank you.
Hey @Anonymous ,
if your data is not changing, a calculated column is fine. But as you see wrong results, I guess you need something dynamic.
For a measure you always need an aggregation like SUM, MAX or something similar. The following syntax should work as a measure:
Status =
IF (
MAX ( myTable[Time] ) >= 0,
"OK",
"NOT OK"
)
Hello @Anonymous ,
yes, because the formula requires not only the column name, but also the table name where the column [Time] is.
Take a look at my example, just put the name of the table before the column like this myTable[Time] or if the table has spaces 'my Table'[Time].
Then you won't get an error.
Hello @selimovd
Sorry, it gives error again 😞
Time is measure like as bellow.
Hey @Anonymous ,
if it's a measure then you don't need an aggregation. Then the following measure should work:
Status =
IF (
[Time] >= 0,
"OK",
"NOT OK"
)
User | Count |
---|---|
68 | |
63 | |
59 | |
54 | |
28 |
User | Count |
---|---|
183 | |
80 | |
62 | |
46 | |
38 |