cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Trist
Frequent Visitor

Date add issue

Hi Everybody,

ı have an ıssue about date . ı am tryıng to calculate order sales for respective dates. such as below;

productıdtotal sales-01.01.2021total sales-01.02.2021total sales-01.03.2021
110010005000
22001502000
33004503000
48008004500

ı have an date filter which is equal to 'Dim_Date'[date] . when ı select 01.01.2021 as date filter, ı want to see to 01.02.2021, 01.03.2021 respectively in fields. so when ı try to add one month to measure ı fail. could you help please? 

measure:

TotalSales = CALCULATE(
SUM('order'[sales])
,FILTER('Dim_Date'[date] <= ['sales'[date]))

 

note: ı tryed datediff and dateadd but ıt doesnt work ı dont know why.

3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

Hi @Trist,

 

Could you provide your pbix file after removing sensitive information?

Maybe you can change data structure in query editor and the apply the measure.

 

Best Regard,

Link

daxer
Solution Sage
Solution Sage

@Trist 

 

Before you start doing anything in PBI and DAX, you should read THIS. Your data is in a wrong shape for analysis in a tabular model.

sayaliredij
Solution Supplier
Solution Supplier

is your table structure same as shown above?

 

I think it would be best if we have table structure as below

 

Product Id    Date    Sales

1                01.01.2021 100

1                01.02.2021  200

1                01.03.2021  500

 

then you can make connection with date table and have filtering like you wanted.

 

Does this make sense?

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors