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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Högkullen
New Member

Handling of sum like rolling 12 - but using date + hour period

Hi

Hope that somone can help me.

 

 

When i use date dimension i works but only for dates (Dim Avslut Date)


I have created a date+hour dimension (Dim Avlut DateHour)

 

The problem to summerize is the show to totalt parking hour by hour for the last 24 hours.

 

On every hour information is stored about ended parking for different parking devices,
on different areas and how long time they have parked.

(So there is a need to summerice this 24 hour slices for every hour to see the Parking Usage - compair to rolling 12 month)

 

DataModell.JPG

 

Using date working fine for the measur but not for date+hour

 

UsageDate =
VAR DSTART=FIRSTDATE(DATEADD('Dim Avslut Date'[FullDateKey];-7;DAY))
VAR DEND=LASTDATE(DATEADD('Dim Avslut Date'[FullDateKey];0;DAY))
RETURN

CALCULATE ( SUM('Fact Besoksparkering_BA_TP'[Antal_Parkering]) ;
DATESBETWEEN('Dim Avslut Date'[FullDateKey];DSTART;DEND))

 

If I understand right, below function support date/time

-FIRSTDATE

-LASTDATE

-DATESBETWEEN

 

What to us instead of DATEADD

 

I have create a calculated column white the starting boundary

 

'Fact Besoksparkering_BA_TP'[KEY_START_DATE_HOUR] -calculated

'Fact Besoksparkering_BA_TP'[KEY_DATE_HOUR]

 

UsageDate24Hour =
VAR DSTART=?? KEY_START_DATE_HOUR
VAR DEND=??   KEY_DATE_HOUR
RETURN

 

CALCULATE ( SUM('Fact Besoksparkering_BA_TP'[Antal_Parkering]) ;
DATESBETWEEN('Dim Avslut Date'[FullDateKey];DSTART;DEND))

 

 

This is end of task 1.

 

The next task is also add a filter to just take summerize how long time they have parked.

I have a dimension with different parking intervalls 1 hour, 2 hours and so on

If you are able calculate the 24 slices you can use this calculation to select the right interval.

 

((DEND-KEY_DATE_HOUR (first one))             * 24) +1 = 1  Summerize intervall >=1

((DEND-KEY_DATE_HOUR (1 hour before - )) * 24) +1 = 2  Summerize intervall >=2

 ..

((DEND-KEY_DATE_HOUR (23 hour before - )) * 24) +1 = 24  Summerize intervall >=24

 

KEY_DATE_HOUR (23 hour before) = KEY_START_DATE_HOUR

 

How can I set up this filter

 

//Lars

 

1 REPLY 1
Högkullen
New Member

Correction

 

UsageDate24Hour =
VAR DSTART=?? KEY_START_DATE_HOUR
VAR DEND=??   KEY_DATE_HOUR
RETURN

 

CALCULATE ( SUM('Fact Besoksparkering_BA_TP'[Antal_Parkering]) ;
DATESBETWEEN('Dim Avslut DateHour'[FullDateKey];DSTART;DEND))

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.