Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
The following measure is not working in powerbi desktop.
3 Months Unit Sold = CALCULATE([Units Sold],DATESINPERIOD(DimDate[FullDateAlternateKey],LASTDATE(DimDate[FullDateAlternateKey]),-3,MONTH))
When the same measure is created in Excel 2016 powerpivot it works.
Is this a bug?
Solved! Go to Solution.
Hi,
Here are the changes i made
=CALCULATE([Units Sold],DATESINPERIOD(DimDate[FullDateAlternateKey],LASTDATE(DimDate[FullDateAlternateKey]),-3,MONTH))
The correct result is shown below
Hi,
The third last column in your FaceInternetSales table is a proper date. The relationship should be from that column to the FullDateAlternateKey column of the DimDate column table.
@Anonymous,
Please elaborate. You may check the relationship and take a look at this link.
Thanks for the response. Relationships are ok and measures in powerbi and excel exactly the same accessing the same database. See images below. 3 Months Unit Sold is the measure in question
From powerbi
From Excel
Sorry, correct Excel table
@Anonymous,
It would be better to share us the simplified .pbix file. Make sure it is a measure, not calculated column.
Sorry just seeing this. How do I attach a file? I don't see any upload buttons. Using MS Edge
Regards
Hi @Anonymous,
You will have to upload the file to some file hosting servive and then share the download link here.
Hi,
Here are the changes i made
=CALCULATE([Units Sold],DATESINPERIOD(DimDate[FullDateAlternateKey],LASTDATE(DimDate[FullDateAlternateKey]),-3,MONTH))
The correct result is shown below
Thanks for your effort and time. Sorry about the late response.
Regards
Hi, I just tried your suggestion and it does not work. To begin, the relationship you suggested cannot work as the duedatekey in the sales table is an integer and the fulldatealternatekey in the date table is a date field. When I created this relationship the resulting table is empty.
I am using powerbi ver 2.50.4859.782 64-bit (September 2017). What version are you using? Remember I indicated that when I used excel with the same sql 2016 adventureworks DW it works correctly by copying and pasting the measure. This suggests a bug in the version I am using or a problem with my installation running on windows 10 pro.
Regards
Hi,
The third last column in your FaceInternetSales table is a proper date. The relationship should be from that column to the FullDateAlternateKey column of the DimDate column table.
Thanks again. I finally realized that because in power bi you don't have the facility to designate a date table then relationships must be based on date fields for the time intelligence functions to work. A work around I found on the internet proposed by Raz is to add the all(dimdate) at the end of the function and that works as well.
You are welcome.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.