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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Very slow measures

Hi all, 

I've been trying to get 2 measures to work more efficiently, and I can't seem to pin down what the problem comes from after hours analyzing it : 

 

ActiveMembers :=
CALCULATE (
    [IsMember],
    FILTER (
        VALUES ( 'Client'[Last order] ),
        LASTDATE ( Client[Last Order] )
            > LASTDATE ( 'Time'[Date] ) - 112
            && LASTDATE ( 'Client'[Last order] ) <= LASTDATE ( 'Time'[Date] )
    )
)
DormantMembers :=
IF (
    HASONEVALUE ( 'Client'[Last Order] ),
    CALCULATE (
        [IsMember],
        FILTER (
            ALL ( 'Time'[Week] ),
            LASTDATE ( Client[Last Order] )
                <= LASTDATE ( 'Time'[Date] ) - 112
        )
    ),
    CALCULATE (
        [IsMember],
        FILTER (
            VALUES ( Client[Last Order] ),
            LASTDATE ( Client[Last Order] )
                <= LASTDATE ( 'Time'[Date] ) - 112
        )
    )
)

 

 

For reference, IsMember is : 

 

IsMember :=
CALCULATE ( DISTINCTCOUNT ( [ID] ), Facts[Member] = 1 )

 

 

Do you have an idea what could be the problem here ? I'm trying to see if I can work upstream and calculate this with an SSIS query instead, but it'd be better to fix it from DAX directly.

 

Kindly,

Nossair

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , if are creating a rolling 112 days formula then try like

 

Rolling 112 = CALCULATE([Is Member],DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-112,day))

 

Can you explain what are you trying to achieve here

Anonymous
Not applicable

Hi amitchandak,

The first measures calculates the number of clients that have made a purchase in the last 16 weeks, and the second calculates the number of clients whose last purchase came before that.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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