Forum Discussion
CONVERT SQL QUERY TO DAX Measure
Anonymousare you trying to get last years values?
do you have a date table? if so you can use
daxmeasure = calculate(sum(account_balance)), SAMEPERIODLASTYEAR(DateTime[DateKey]))
- Anonymous8 years agoNot applicable
Dear vanessafvg,
thanks for your answer.yes I want to get last years values
but the resultes show with me not the same sql query resulte , also i don't have date table, how i can cearte **bleep** and what are the values must be inside table to apply your answer ,kindly find snapshop image after applying your answer without date table , i use only my attribute called "as_of_date
"
- vanessafvg8 years agoCommunity Champion
Anonymous you have to have a continious date range to use the function, therefore you need a data table
you can use this script to create a date table
www.mattmasson.com/2014/02/creating-a-date-dimension-with-a-power-query-script/
then link the date to the date in your table
then create the measure
- Anonymous8 years agoNot applicable
Dear vanessafvg,
thanks for your answer.Can You guid me how I can create date table in power bi and where I can paste Script ?
Best Regards,