Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I'm using this formula...
TotalIncomeLastYear = CALCULATE([Income4000'sCalc],SAMEPERIODLASTYEAR('Trandata'[DataDate]))
When I put it onto my report I get the error
MdxScrip(Model)(50,69) Calculation Error in this measure. 'Trandata'[TotalIncomeLastYear]: Function "SAMEPERIODLASTYEAR" expects a contiguous selection when the date column is not unique, has gaps or it contains time portion.
I did a search and this appears typically when there is slicers on the page...I have no slicers or page level filters so I'm not sure where to go from here...
Solved! Go to Solution.
Hi @unclejemima,
Based on my test, here we need to create a separate date table.
Table = CALENDAR(DATE(2016,01,01),DATE(2019,12,31))
Then create relationship between the Trandata table and the date table, and create the two measures.
Income4000'sCalc = SUM(Trandata[Income])
TotalIncomeLastYear = CALCULATE([Income4000'sCalc],SAMEPERIODLASTYEAR('Table'[Date]))
Finally, we can get the result as below.
For more details, please check the pbix as attached.
Regards,
Frank
Hi @unclejemima,
Based on my test, here we need to create a separate date table.
Table = CALENDAR(DATE(2016,01,01),DATE(2019,12,31))
Then create relationship between the Trandata table and the date table, and create the two measures.
Income4000'sCalc = SUM(Trandata[Income])
TotalIncomeLastYear = CALCULATE([Income4000'sCalc],SAMEPERIODLASTYEAR('Table'[Date]))
Finally, we can get the result as below.
For more details, please check the pbix as attached.
Regards,
Frank
Hi @unclejemima,
Does that make sense? If so , kindly mark the answer as a solution to close the case, thanks in advance.
Regards,
Frank
User | Count |
---|---|
82 | |
80 | |
66 | |
49 | |
46 |
User | Count |
---|---|
103 | |
44 | |
39 | |
39 | |
39 |