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
MaWrob
Helper III
Helper III

Calculation for a last month metric

How do I calculate a metric which is the following for the last month.

What I have does not work:

this table 'time to conversion is connected to 'dim_date[Date]

% one session conversions = 
CALCULATE(
    COUNT('time_to conversion'[user_pseudo_id]),
    'time_to conversion'[Session To Conversion Band] = "1"
)
/ DISTINCTCOUNT('time_to conversion'[user_pseudo_id])


 

1 ACCEPTED SOLUTION
vojtechsima
Resident Rockstar
Resident Rockstar

Hello, @MaWrob ,

it depends on how you define last month but, if you have a calendar with some flag or just have Slicer.
you can do something like this.

 

% one session conversions = 
CALCULATE(
CALCULATE(
    COUNT('time_to conversion'[user_pseudo_id]),
    'time_to conversion'[Session To Conversion Band] = "1"
)
/ DISTINCTCOUNT('time_to conversion'[user_pseudo_id]),
'calendar'[YearMonth]=MAX('calendar'[YearMonth])
)


alternatively using TOTALMTD

% one session conversions = 
TOTALMTD(CALCULATE(
    COUNT('time_to conversion'[user_pseudo_id]),
    'time_to conversion'[Session To Conversion Band] = "1"
)
/ DISTINCTCOUNT('time_to conversion'[user_pseudo_id]), 'calendar'[Date])

or datesmtd

% one session conversions = 
CALCULATE(
CALCULATE(
    COUNT('time_to conversion'[user_pseudo_id]),
    'time_to conversion'[Session To Conversion Band] = "1"
)
/ DISTINCTCOUNT('time_to conversion'[user_pseudo_id]),
DATESMTD('calendar'[Date]) )

View solution in original post

1 REPLY 1
vojtechsima
Resident Rockstar
Resident Rockstar

Hello, @MaWrob ,

it depends on how you define last month but, if you have a calendar with some flag or just have Slicer.
you can do something like this.

 

% one session conversions = 
CALCULATE(
CALCULATE(
    COUNT('time_to conversion'[user_pseudo_id]),
    'time_to conversion'[Session To Conversion Band] = "1"
)
/ DISTINCTCOUNT('time_to conversion'[user_pseudo_id]),
'calendar'[YearMonth]=MAX('calendar'[YearMonth])
)


alternatively using TOTALMTD

% one session conversions = 
TOTALMTD(CALCULATE(
    COUNT('time_to conversion'[user_pseudo_id]),
    'time_to conversion'[Session To Conversion Band] = "1"
)
/ DISTINCTCOUNT('time_to conversion'[user_pseudo_id]), 'calendar'[Date])

or datesmtd

% one session conversions = 
CALCULATE(
CALCULATE(
    COUNT('time_to conversion'[user_pseudo_id]),
    'time_to conversion'[Session To Conversion Band] = "1"
)
/ DISTINCTCOUNT('time_to conversion'[user_pseudo_id]),
DATESMTD('calendar'[Date]) )

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!

November Carousel

Fabric Community Update - November 2024

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

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.