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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Unable to view week over week differences by fiscal week in qtr on bar graph (Dateadd error)

Hi Datanauts,
I have a data set with data containing number of assigned seats and provisioned seats. I calculated the week over week difference by first creating a measure  "Total upto last week" by summing the provisioned seats and using a dateadd function and created another measure to calculate the difference between the sum of provisioned seats and total upto last week. I want to view these by the 13 weeks in a quarter, but the visual breaks when I try to add them to the graph. This is the error I get.

Error Message:
MdxScript(Model) (8, 127) Calculation error in measure 'cce_pro_dashboard'[Total Prov upto Last Week]: Function 'DATEADD' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion.
I am also attaching a link to the sample pbix file, please download it:
https://drive.google.com/open?id=1hYDaBCJQNGfp1XGeNzAxeVAbGiNlaBMX

Thanking you in advance.
Akash.

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You can create calendar table like DAX below, then create relationship between your fact data table and calendar table on date field.

 

Calendar = CALENDAR(MIN(data[Date]),MAX(data[Date]))  

 

Or

 

Calendar =CALENDARAUTO() .

 

Then you can create the [Total prov upto last week] using calendar[Date].

 

Total prov upto last week = CALCULATE(SUM(data[provisioned_seats]),DATEADD(calendar[Date],-7,DAY))

 

Best Regards,

Amy

 

Community Support Team _ Amy

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

Anonymous
Not applicable

Hi Amy (@v-xicai),
Thank you for your response. I have tried this, and created a relationship between the two tables, but it doesn't work. I also tried bringing in a fiscal_date table but to no avail 😞
Best,
Akash. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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