问题
I am very new to DAX and i want sum of sales for the previous months. As you can see, the dates are : The 15th of every month and the last day of every month. Can anyone please help me?
I want when i use the date as a filters , when i chose a date, i want the measure to give me the results of the previous date.
回答1:
Have you tried making a calculated column that shows the "previous date" for each date. If that is successful then possibly you could return the result using the date from the "previous date" calculated column when the row with a date was selected.
回答2:
OK. Thanks for posting this. Working on it has been very instructive. I've attached a copy of my power bi file and a pdf
this may not be a solution you can use... it does show both amounts received during the month and the total for the month (months are displayed as numbers)
The core trick I used was to create 2 calculated columns for each row, one for the 15th the other for the end of the month. I populated them with a zero or the amount in the row depending on what the date field in the row looked like. that gave me amounts i could summarize.
https://drive.google.com/file/d/1hdM5QKonEft4sYk2yyD0JLlXJcEb3baU/view?usp=sharing
来源:https://stackoverflow.com/questions/57338137/calculate-sales-for-previous-dates-mid-month-and-end-month-using-dax