Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KristianS
New Member

Weekly sales measure is not working correctly, looks like something is wrong with the relationship.

Hello,
My weekly sales measure looks like this:

RWT Sales (week):=CALCULATE([Sales],'Order Date'[Date] >= TODAY()-6,'Order Date'[Date]<=TODAY())

It works fine when im combining it with customer data, but i would like to show it pr day in a visual. But when i use my order date table it looks like this (in a table):

And it continues through 2040 (which is the size of my 'order date' table. What am i doing wrong?

 
 
 

1e835e3xbsn41.png

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @KristianS , 

I think you need to add filter in expression like below

RWT Sales (week):=CALCULATE([Sales],filter('Order Date','Order Date'[Date] >= TODAY()-6 && 'Order Date'[Date]<=TODAY()))

If this doesn't work, please check whether your order date table have relationship between your fact table(or measure [Sales]). You could inform me your data structure and your relationship.

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
dax
Community Support
Community Support

Hi @KristianS , 

I think you need to add filter in expression like below

RWT Sales (week):=CALCULATE([Sales],filter('Order Date','Order Date'[Date] >= TODAY()-6 && 'Order Date'[Date]<=TODAY()))

If this doesn't work, please check whether your order date table have relationship between your fact table(or measure [Sales]). You could inform me your data structure and your relationship.

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot! Addig Filter worked.

What does that do? I thought the calculate function automaticly add filters.

amitchandak
Super User
Super User

Try like


RWT Sales (week):=CALCULATE([Sales],filter('Order Date','Order Date'[Date] >= max('Order Date'[Date])-6 && 'Order Date'[Date]max('Order Date'[Date])))

with Date calendar
RWT Sales (week):=CALCULATE([Sales],filter('Date','Date'[Date] >= max('Date'[Date])-6 && 'Date'[Date]max('Date'[Date])))

az38
Community Champion
Community Champion

Hi @KristianS 

if you need running total day by day it is incorrect to compare dates with today() which is always the same for each row

try

RWT Sales (week):=CALCULATE([Sales],'Order Date'[Date] >= SELECTEDVALUE('Order Date'[Date]),'Order Date'[Date]<=SELECTEDVALUE('Order Date'[Date]))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.