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.
Hi all,
I have measure this measure
any idea why cannot use 1) option?
thx
Solved! Go to Solution.
In order for PowerBI to recognize a custom date table as something more than a table that happens to have dates in it, you have to mark it as a date table.
Going back to the measure vs calculated column, measures will show up in the Fields pane with all your other fields, but they don't actually exist in the table itself. You can see here that the icon for a measure (a calculator) is different than the icon for a calculated column (table with function symbol).
If [last date] is a measure, then you should be able to get rid of the table reference in your [last date - 12M] measure like so:
last date - 12M = DATEADD([last date]; -12;MONTH)
Unfortunately, you'll still get the same error. This is because DATEADD expects a column of date values. You're passing it a single date value from your [last date] measure. This may seem confusing because according to the documentation, LASTDATE returns a table with a single column and row with the last date from the original list.
However, when the result of a DAX measure is a single column/single row table with a value, the measure will return just the value, not the entire table. So when you pass the result of the [last date] measure to DATEADD, you're technically getting a different output than when you use the whole LASTDATE expression.
You could try using EDATE instead of DATEADD, since it accepts a single date instead of a date column. More than likely, I would just do what you did, which is to explicitly write out the entire expression in the second measure.
Funnily enough, I actually found this which uses the exact issue you're facing as an instructional tool for this problem: https://powerpivotpro.com/2018/06/navigating-dax-function-types-a-list-of-dax-scalar-and-table-funct...
In order for PowerBI to recognize a custom date table as something more than a table that happens to have dates in it, you have to mark it as a date table.
Going back to the measure vs calculated column, measures will show up in the Fields pane with all your other fields, but they don't actually exist in the table itself. You can see here that the icon for a measure (a calculator) is different than the icon for a calculated column (table with function symbol).
If [last date] is a measure, then you should be able to get rid of the table reference in your [last date - 12M] measure like so:
last date - 12M = DATEADD([last date]; -12;MONTH)
Unfortunately, you'll still get the same error. This is because DATEADD expects a column of date values. You're passing it a single date value from your [last date] measure. This may seem confusing because according to the documentation, LASTDATE returns a table with a single column and row with the last date from the original list.
However, when the result of a DAX measure is a single column/single row table with a value, the measure will return just the value, not the entire table. So when you pass the result of the [last date] measure to DATEADD, you're technically getting a different output than when you use the whole LASTDATE expression.
You could try using EDATE instead of DATEADD, since it accepts a single date instead of a date column. More than likely, I would just do what you did, which is to explicitly write out the entire expression in the second measure.
Funnily enough, I actually found this which uses the exact issue you're facing as an instructional tool for this problem: https://powerpivotpro.com/2018/06/navigating-dax-function-types-a-list-of-dax-scalar-and-table-funct...
Hello @Anonymous
thanks for response
1) I creating and using my own tables and not automatically generated. Can you be please more specific what is wrong from your point of view?
2) Yes, it is measure, that is valid for each row (is the same for each row) and when I added to the table I see it as a column (same value for the each row)
I am sorry but this is unlogic, the measure returns always the only one output and you wrote that when is it nested it works..or is it some special feature of DAX?
thanks
Hello @Anonymous
1) really don t know how, why is it happen..it must be caused PBI, because I fill dim Date my own values, and when I start writing code the 'hint' finish it...really don t know what s happen and how to fix it
2) Believe me that I am trying hard to understand DAX, contexts..materials are plenty as you wrote but most of them are focusing on the skilled DAX experts and not newbies like me (i.e. MS official documentation, if you want to understand example of mentioned function which they describe, you must learn all mentioned function before you reach the one that is descibe in article, so without basic knowledge you cannot learn new function). The Italians , very similar case..they are focusing on professionals...therefore I am writing my questions here, because I have no contact/chance to ask to any profesional...if you have link on the DAX for dummies with plenty of examples I will be happy..I am sorry if my questions are weird, but I am trying to understand how is it works...
Hi there.
Please, start with this book:
Matt Arlington, How to Write DAX (£9.64 for the Kindle edition)
It should be digestible for newbies like you.
Secondly, if you had a proper Date table connected to your fact table, the automatically generated one would also automatically disappear. Since it has not, I have a right to assume your model is not correct and you're still relying on the automatic tables. This is bad for many reasons, too many to tell you about them here. But you can take my word for that.
Best
Darek
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 | |
19 | |
14 | |
10 |
User | Count |
---|---|
57 | |
49 | |
44 | |
18 | |
18 |