Forum Discussion
Russo's formula doesn't work
This is the formula in page 139 of the book The Definitive Guide to DAX (first edition) by Marco Russo and Alberto Ferrari
Where
However, it returned BLANK when tested with the data!!!
Could someone please explain what error(s) had the authors made in that formula?
Hi Valtteri,
I believe the reason you couldn't replicate the BLANK value for the troublesome formula because the relationship between 'Calendar'[Date] and 'Table (16)'[Date2] was active.
If I changed the relationship between 'Date'[Date] and 'Sales'[Delivery Date] from inactive to active, the troublesome formula would work.
In conclusion, the BLANK value was caused by either a bug with PBI or wrong formula by Russo.
Once again, thanks for your contributions to my question.
8 Replies
- ValtteriNCommunity Champion
Hi,
The formula seems to be correct. It filters Sales table to only include numbers from 2007 and then calculates sales over the filtered table so that Sales[quantity] is multiplied by Sales[unit Price]. Since the formlua is returning blank check the following things:
1. Is there sales data for the year 2007
2. Is your [DeliveryDateKey] and [DateKey] formatted in the same way -> e.g. both should be Date or both should be Date/Time
3. Double check your relationships
You can easily check if the measure is working as expected by taking the FILTER portion of the dax and creating a calculated table using "New table" or placing the dax inside EVALUATE in the new section of Power BI:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/- nemoHelper I
Hi Valtteri,
Thank you for your response.
Followed your advice, I found that the authors made a typo: it should be 'Date'[Date] instead of 'Date'[DateKey].
Although the test table (evaluated from the FILTER(CALCULATETABLE...) did return values, the measure Delivered Amount in 2007 was still blank.
Was this a bug with Power BI?
- ValtteriNCommunity Champion
Hi,
Was there also data in your Test[Unit Price]? All in all, based on this test I would say the measure is correct and i suspect some other issue with your filter context is resulting in this blank value.