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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
BjoernSchaefer
Helper II
Helper II

Calculate 12/24 Month Difference from a Quarter

Hi,

I am facing a challenge: I have a table "fct_BASE" with the columns FAZID and DATE_PERFORMANCE. I need 2 measures that give me the count of FAZID from the end of the quarter. It is linked to a Calendar and another dimesnsion Table

 

The tabel ist structured as follows:

FAZIDDATE_PERFORMANCE
SYS000291018.07.2023
SYS000291017.08.2021
SYS000291025.10.2022
SYS000292004.05.2023
SYS000292009.12.2021
SYS000292015.10.2020
SYS000292020.07.2021
SYS000292020.07.2021
SYS000292020.07.2021


That is the Outcome of the two Measures underneath the table:

YearQuarter12 Mon24 Mon
202313335133351
202322844828448

 

These are the measures:

 

 

 

 

12_Mon:=
VAR Quarter_End = MAX(dim_Calendar[Date])
RETURN
CALCULATE (
COUNT ( fct_Base[FAZID] ),
ALL(fct_Base[DATE_PERFORMANCE]),
fct_Base[DATE_PERFORMANCE] >= Quarter_End - 365,
fct_Base[DATE_PERFORMANCE] <= Quarter_End
)

24_Mon:
=VAR Quarter_End = MAX(dim_Calendar[Date])
RETURN
CALCULATE (
COUNT ( fct_Base[FAZID] ),
ALL(fct_Base[DATE_PERFORMANCE]),
fct_Base[DATE_PERFORMANCE] >= Quarter_End - 730,
fct_Base[DATE_PERFORMANCE] <= Quarter_End
)

 

 

 

 

I don't understand why the values in the columns are identical.
Does anybody has a clue?
Thanks a thousand times in advance.

Regards

 

Björn

1 ACCEPTED SOLUTION
JoeBarry
Solution Sage
Solution Sage

Hi @BjoernSchaefer 

 

Please try this. 

1st measure

Total Fazid = Count(fct_base[FAZID])

 

2nd measure using the measure previously

last 12 Months = CALCULATE (
    [Total Fazid],
    DATESINPERIOD ( 'DIM Date'[Date], MAX ( 'DIM Date'[Date] ), -12, MONTH )

 

3rd

 

last 24 Months = CALCULATE (
    [Total Fazid],
    DATESINPERIOD ( 'DIM Date'[Date], MAX ( 'DIM Date'[Date] ), -24, MONTH )

 

Thanks

Joe

View solution in original post

2 REPLIES 2
JoeBarry
Solution Sage
Solution Sage

Hi @BjoernSchaefer 

 

Please try this. 

1st measure

Total Fazid = Count(fct_base[FAZID])

 

2nd measure using the measure previously

last 12 Months = CALCULATE (
    [Total Fazid],
    DATESINPERIOD ( 'DIM Date'[Date], MAX ( 'DIM Date'[Date] ), -12, MONTH )

 

3rd

 

last 24 Months = CALCULATE (
    [Total Fazid],
    DATESINPERIOD ( 'DIM Date'[Date], MAX ( 'DIM Date'[Date] ), -24, MONTH )

 

Thanks

Joe

Hey @JoeBarry ,

 

Thank you very much. I couldn't see the forest for the trees.
Regards

Björn

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.