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
Analitika
Post Prodigy
Post Prodigy

Very slow perfomance

How to improve performance of table matrix?

 

PBI

https://easyupload.io/dvwdc0

6 REPLIES 6
amitchandak
Super User
Super User

@Analitika , not too bad in my case. The first matrix is slow. All values of the measure are the same. Is it expected or some measure problem

It only 2 customer of 100.000  on original version not loading at all, problem with m_SSA_3 measure. I have no idea how to make it work

The problem is this M_SSA_3 measure:

m_SSA_3 =
VAR valText1 = [ABC_LIKUČIAI_1]
VAR valText12 = [ABC_LIKUČIAI_2]
VAR Result =
    CALCULATE(
        CALCULATE(
            CALCULATE(
                SUM( Table1[OPE_SUMOL] ),
                FILTER(
                    Table1,
                    Table1[OP_ATS]
                        IN {
                        0
                    }
                        && NOT Table1[OP_VIE] = 3
                        && NOT Table1[ZU0_KOD]
                        IN {
                        valText1,
                        valText12
                    }
                )
            ),
            FILTER(
                ALL( 'Date'[Date] ),
                'Date'[Date]
                    <= MAX( 'Date'[Date] )
            )
        )
            - CALCULATE(
                CALCULATE(
                    SUM( Table1[OPE_SUMOL] ),
                    FILTER(
                        Table1,
                        Table1[OP_ATS]
                            IN {
                            0
                        }
                            && Table1[OP_VIE] = 3
                            && NOT Table1[ZU0_KOD]
                            IN {
                            valText1,
                            valText12
                        }
                    )
                ),
                FILTER(
                    ALL( 'Date'[Date] ),
                    'Date'[Date]
                        <= MAX( 'Date'[Date] )
                )
            )
            - CALCULATE(
                CALCULATE(
                    SUM( Table1[OPE_SUMOL] ),
                    FILTER(
                        Table1,
                        Table1[OP_ATS]
                            IN {
                            2
                        }
                            && NOT Table1[ZU0_KOD]
                            IN {
                            valText1,
                            valText12
                        }
                    )
                ),
                FILTER(
                    ALL( 'Date'[Date] ),
                    'Date'[Date]
                        <= MAX( 'Date'[Date] )
                )
            )
            - CALCULATE(
                CALCULATE(
                    SUM( Table1[OPE_SUMOL] ),
                    FILTER(
                        Table1,
                        Table1[OP_ATS]
                            IN {
                            0
                        }
                            && Table1[ZU0_KOD]
                            IN {
                            valText1,
                            valText12
                        }
                            && Table1[_MZA2] > 0
                    )
                ),
                FILTER(
                    ALL( 'Date'[Date] ),
                    'Date'[Date]
                        <= MAX( 'Date'[Date] )
                )
            )
            - CALCULATE(
                CALCULATE(
                    SUM( Table1[OPE_SUMOL] ),
                    FILTER(
                        Table1,
                        Table1[OP_ATS]
                            IN {
                            0
                        }
                            && Table1[ZU0_KOD]
                            IN {
                            valText1,
                            valText12
                        }
                            && Table1[_MZA2] < 0
                    )
                ),
                FILTER(
                    ALL( 'Date'[Date] ),
                    'Date'[Date]
                        <= MAX( 'Date'[Date] )
                )
            ),
        FILTER(
            Table2,
            Table2[SK/AV] = "IAT"
        )
    )
RETURN
    /*IF (
       "PREK_G" IN DISTINCT ( Table1[rus_kod] )|| "NUOLAI" IN DISTINCT ( Table1[rus_kod] ), Result, -Result 
    )*/
    IF(
        SELECTEDVALUE( Table1[rus_kod] ) = "PREK_G"
            || SELECTEDVALUE( Table1[rus_kod] ) = "NUOLAI",
        Result,
        - Result
    )

And the M_SSA_4 is only slightly better. Those nested CALCULATES are doing all sorts of context transitions and reitterating over the tables. That needs to be totally reworked, and it needs to be scoped out as to what it is trying to do.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

I know that, but dont know how to improve that sh*t. 

Calculates different rows sums by different markers, as they describe different things such income, outcome, stocks and etc.

This is really more of a consulting question and you'd need to spend some time explaining to a DAX developer what the goal is and how the data is laid out. Perhaps someone can jump in, but this looks like several hours of work to me.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

I myself have not figured out the logic yet, I got such a gift from previous analysts

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.