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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Slow Measure

Hi dear, I have the following measure that currently works well however being part of a multilevel report when deploying a category that can contain up to 800 items the calculation becomes slow and consequently the matrix display my question is how can I improve that measure so that it calculates only on the current level that I am selecting (displaying) in the matrix.

Volume3:=SWITCH(TRUE(),
HASONEVALUE(Sales[Item]),[Volume2],
HASONEVALUE(Division[DivShort]),(DIVIDE(Sales[Qtty Current],Sales[Qtty Last],0)-1)*Sales[MXP-USD Last],
HASONEVALUE(Customer[SECTOR]),(DIVIDE(Sales[Qtty Current],Sales[Qtty Last],0)-1)*Sales[MXP-USD Last],
HASONEVALUE(Customer[Holding]),(DIVIDE(Sales[Qtty Current],Sales[Qtty Last],0)-1)*Sales[MXP-USD Last],
HASONEVALUE(Vendor[Name]),(DIVIDE(Sales[Qtty Current],Sales[Qtty Last],0)-1)*Sales[MXP-USD Last],
HASONEVALUE(Sales[CURR]),SUMX(VALUES(Class[Description Class]),Sales[ZVolume2]),
BLANK()
)
1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous 

I would suggest you could create several measures to achieve that.For example:

Measure1=(DIVIDE(Sales[Qtty Current],Sales[Qtty Last],0)-1)*Sales[MXP-USD Last]
Measure2=SUMX(VALUES(Class[Description Class]),Sales[ZVolume2])
Volume3 :=
SWITCH (
    TRUE (),
    HASONEVALUE ( Sales[Item] ), [Volume2],
    HASONEVALUE ( Division[DivShort] ), [Measure1],
    HASONEVALUE ( Customer[SECTOR] ), [Measure1],
    HASONEVALUE ( Customer[Holding] ), [Measure1],
    HASONEVALUE ( Vendor[Name] ), [Measure1],
    HASONEVALUE ( Sales[CURR] ), [ Measure2],
    BLANK ()
)

Or

Volume3 :=
IF (
    HASONEVALUE ( Sales[Item] ),
    [Volume2],
    IF (
        HASONEVALUE ( Division[DivShort] ) || HASONEVALUE ( Customer[SECTOR] )
            || HASONEVALUE ( Customer[Holding] )
            || HASONEVALUE ( Vendor[Name] ),
        [Measure1],
        IF ( HASONEVALUE ( Sales[CURR] ), [ Measure2] )
    )
)

Regards,

Community Support Team _ Cherie Chen
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-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous 

I would suggest you could create several measures to achieve that.For example:

Measure1=(DIVIDE(Sales[Qtty Current],Sales[Qtty Last],0)-1)*Sales[MXP-USD Last]
Measure2=SUMX(VALUES(Class[Description Class]),Sales[ZVolume2])
Volume3 :=
SWITCH (
    TRUE (),
    HASONEVALUE ( Sales[Item] ), [Volume2],
    HASONEVALUE ( Division[DivShort] ), [Measure1],
    HASONEVALUE ( Customer[SECTOR] ), [Measure1],
    HASONEVALUE ( Customer[Holding] ), [Measure1],
    HASONEVALUE ( Vendor[Name] ), [Measure1],
    HASONEVALUE ( Sales[CURR] ), [ Measure2],
    BLANK ()
)

Or

Volume3 :=
IF (
    HASONEVALUE ( Sales[Item] ),
    [Volume2],
    IF (
        HASONEVALUE ( Division[DivShort] ) || HASONEVALUE ( Customer[SECTOR] )
            || HASONEVALUE ( Customer[Holding] )
            || HASONEVALUE ( Vendor[Name] ),
        [Measure1],
        IF ( HASONEVALUE ( Sales[CURR] ), [ Measure2] )
    )
)

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors