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
mkinal
Regular Visitor

Measure result differs based on order applied onto visual

Hi All,

 

I have a wierd problem: the result of two measures depend on the order they are applied onto a Matrix visual. Could this be a storage engine bug? If I change the order of the measure after they were applied onto the visual, nothing happens. I have to delete one measure and apply back again for the changes to take effect.

 

Here are my tables:

Screenshot 2022-05-16 152653.png

 

Here's the first result:

Screenshot 2022-05-16 152750.png

 

And here's the second one:

Screenshot 2022-05-16 152831.png

 

And heres' my DAX:

 

 

Article Motive Count =
COUNTROWS ( article_motives )

 

 

 

Aftersales Motives = 
    VAR PackageSelection2 = {"P6 - Backpack"} --,"P2 - Subpart","P6 - Backpack","P9 - Shoe","P10 - Accessory"}
    VAR RelevantPackages2 =
        CALCULATETABLE(
            article_packages,
            packages[name] IN PackageSelection2
        )
    VAR RelevantMotives2 =
        CALCULATETABLE(
            VALUES( package_motives[motive_id] ),
            RelevantPackages2
        )
    VAR MotivesNeeded2 =
        CALCULATE(
            [Article Motive Count],
            TREATAS( RelevantMotives2, article_motives[motive_id])
        )
    RETURN
        MotivesNeeded2

 

 

 

Pre-sales Motives = 
    VAR PackageSelection = {"P1 - Toppart","P2 - Subpart","P6 - Backpack","P9 - Shoe","P10 - Accessory"}
    VAR RelevantPackages =
        CALCULATETABLE(
            article_packages,
            packages[name] IN PackageSelection
        )
    VAR RelevantMotives =
        CALCULATETABLE(
            VALUES( package_motives[motive_id] ),
            RelevantPackages
        )
    VAR MotivesNeeded =
        CALCULATE(
            [Article Motive Count],
            TREATAS( RelevantMotives, article_motives[motive_id])
        )
    RETURN
        MotivesNeeded

 

 

 

3 REPLIES 3
mkinal
Regular Visitor

Hi there!

 

Anyone has any idea why this could happen?

mkinal
Regular Visitor

Hi @v-rzhou-msft !

 

Thanks for the reponse!

 

To make things a bit more clear here are my steps:

1. Apply 'Aftersales Motives' measure onto the visual. Result: 249 - good result

2. Apply 'Pre-Sales Motives' measure onto the visual. Result: 249 - wrong result

3. Remove the two measures from the visual

4. Apply 'Pre-Sales Motives' measure onto the visual. Result: 1392 - good result

5. Apply 'Aftersales Motives' measure onto the visual. Result: 1392 - wrong result

 

So basically the measure applied second takes the value of the one applied first. If I change the order in the Visualizations pane, that doesn't change the results, only if I remove the measure that was applied first.

 

Here's the sample file: https://we.tl/t-XAMvYX6G0c

 

Best,

Marcrell

 

v-rzhou-msft
Community Support
Community Support

Hi @mkinal ,

 

This should be caused by your data model. Which one is the correct subtotal, first one or second one? Or both of them are incorrect.

Could you share a sample file with me and show the result you want? This  will make me easier to find the solution.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.