Forum Discussion

mc_gadhzalova's avatar
mc_gadhzalova
Regular Visitor
2 years ago
Solved

NUMERIC DISTRIBUTION - MEASURE ISSUE

Hi All,   I have been struggling to create a measure to calculate numeric distribution.  I need measure/s that calculate if a brand is avaliable in a store and then compared to the total number st...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi mc_gadhzalova ,

    You can create a measure as below to get it, please find the details in the attachment.

    BRAND DISTRIBUTION = 
    VAR _tab =
        SUMMARIZE (
            'Table',
            'Table'[COUNTRY],
            'Table'[MONTH],
            'Table'[STORE],
            'Table'[BRAND],
            "@count",
                CALCULATE (
                    COUNT ( 'Table'[COUNTRY] )  , 
                 FILTER (
                        'Table',
                        'Table'[COUNTRY] = EARLIER ( 'Table'[COUNTRY] )
                            && 'Table'[MONTH] = EARLIER ( 'Table'[MONTH] )
                            && 'Table'[STORE] = EARLIER ( 'Table'[STORE] )
                            && 'Table'[BRAND] = EARLIER ( 'Table'[BRAND] )
                            && 'Table'[EXISTS] = 1
                    )
                )
        )
    VAR _count =
        COUNTX ( _tab, [@count] )
    RETURN
        IF ( _count > 0, 1, 0 )

    Best Regards