calculate sales for previous dates (mid-month and

2019-08-23 11:50发布

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.

image

2条回答
叛逆
2楼-- · 2019-08-23 12:11

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.

查看更多
我想做一个坏孩纸
3楼-- · 2019-08-23 12:19

OK. Thanks for posting this. Working on it has been very instructive. I've attached a copy of my power bi file and a pdfpicture of the report

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

查看更多
登录 后发表回答