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
Anonymous
Not applicable

Caching computed measures on row level

Hello,

 

I have a question regarding the optimization of a measure.
Assuming the following situation:

Connection to a SSAS cube.

 

One Measure "Delta" is computed for each row in a table. Now I want to compute the count of the rows, when "Delta" is between two values, i.e. -1,5 < "Delta" < 1,5.

I also have to do this for different intervals: -3 to -1,5 etc.

Since the computation of "Delta" is rather expensive, I would like to avoid to compute the same value multiple times.

Is there some way of chaching the result of "Delta"?

 

Small example:

 

powerBI_delta.PNG

 

Right now I am computing the count this way (simplified for readability):

+/- 1,5= 
VAR minDateP = ...
VAR maxDateP = ...
    
VAR minDateM = ...
VAR maxDateM = ...

RETURN
    SUMX (
        FILTER('Company';'Company'[Id] IN VALUES('Company2'[Id]));
        VAR pP = CALCULATE(SUM('Sales'[Amount]);FILTER('Calendar';'Calendar'[Date]>=minDateP && 'Calendar'[Date]<=maxDateP))
        VAR pM = CALCULATE(SUM('Sales'[Amount]);FILTER('Calendar';'Calendar'[Date]>=minDateM && 'Calendar'[Date]<=maxDateM))

        
        VAR delta = pP -pM
        RETURN
            IF ( delta > -1,5 && delta < 1,5 && NOT ( ISBLANK ( delta ) ); 1; 0 )        
    )
    

Thanks for any help!

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Since the calculation of measures needs context, I'm afraid "storing the results of a measure" is also expensive. There could be workarounds for each specialized scenario. That is the calculated table. The result of measure will be stored in this scenario.

 

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

1 REPLY 1
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Since the calculation of measures needs context, I'm afraid "storing the results of a measure" is also expensive. There could be workarounds for each specialized scenario. That is the calculated table. The result of measure will be stored in this scenario.

 

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
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.