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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
mgirou
Helper II
Helper II

Date Graph issue

Hello,

 

I've been spending a lot of time trying to figure this out, but i just can't seem to find a way. Right now we use a simple KPI (revenue/hours) and i am trying to show KPI/Month but only for the last 12 months. The ISSUE is that for every month indicated on the X-Axis should be 12 months prior to that month.

 

for example right now it should be October 2016 to October 2017. for February 2017 i need my measure to grab (February 2016 to February 2017) data. Right now with my measure just Revenue/Hours i just grabs the KPI for the month displayed.

 

Any help would be great. I hope i gave enough details.

 

Capture.PNG

2 ACCEPTED SOLUTIONS

Actually i found the solution, but i can't explain why i am hoping someone can shed light on why this worked. By using that formula i just delete the ,date at the end of each reference to Calendar'[Date].[Date]. Can anyone explain why this fixed it?

View solution in original post

Hi @mgirou,

 

I think the .[Date] changes the context of the formula. That's why the result is wrong. Have a look at the picture, the context of the visual is Date while it's [Date] in the formula, which is similar with [Day], [Month], etc. 

 Date Graph issue .jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Please mark your answer as the solution.

 

 

Best Regards!

Dale

Community Support Team _ Dale
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
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @mgirou,

 

Try a formula like this please. You need a date table.

QuantityInLastMonth =
CALCULATE (
    SUM ( 'Sales'[Quantity] ),
    DATESINPERIOD ( 'Date'[Date], LASTDATE ( 'Date'[Date] ), -1, YEAR )
)

Date Graph issue.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

Thank you @v-jiascu-msft , but i have tried this formula and it doesnt give me the right numbers. I do have a date table.

 

This is my formula (KPI test = CALCULATE(SUM('projectdata task_invoicing_lines'[Total Revenue]),DATESINPERIOD('Calendar'[Date].[Date],LASTDATE('Calendar'[Date].[Date]),-1,YEAR))/CALCULATE(SUM('projectdata employeehours'[Hours]),DATESINPERIOD('Calendar'[Date].[Date],LASTDATE('Calendar'[Date].[Date]),-1,YEAR)))

 

What i do to compare this is just manually adjust a date for a certain month (lets say april) and i get the data from april1 2016 to april 1 2017 = 30.16  and that number doesn't match what i have for april with this formula.

Capture.PNG

 

Please let me know if theres anything else i can try.

 

Thanks

Actually i found the solution, but i can't explain why i am hoping someone can shed light on why this worked. By using that formula i just delete the ,date at the end of each reference to Calendar'[Date].[Date]. Can anyone explain why this fixed it?

Hi @mgirou,

 

I think the .[Date] changes the context of the formula. That's why the result is wrong. Have a look at the picture, the context of the visual is Date while it's [Date] in the formula, which is similar with [Day], [Month], etc. 

 Date Graph issue .jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Please mark your answer as the solution.

 

 

Best Regards!

Dale

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

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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