Forum Discussion

xariet's avatar
xariet
Icon for Helper I rankHelper I
3 years ago
Solved

Dynamic Segmentation

Hi All I am struggling to correctly calculate bins_Segments. I have an Annual Income table :  Annual Income = GENERATESERIES(18000, 1560000,1000) and [Value1] is the column in this table with gen...
  • v-yanjiang-msft's avatar
    3 years ago

    Hi xariet ,

    According to your description, I create a same sample and here's my solution, create a measure.

    Bins_segments =
    CALCULATE (
        COUNTROWS ( SUMMARIZE ( 'Annual Income', 'Annual Income'[Value1] ) ),
        FILTER (
            'Annual Income',
            MOD (
                'Annual Income'[Value1]
                    - MINX ( ALL ( 'Annual Income' ), 'Annual Income'[Value1] ),
                SELECTEDVALUE ( 'Parameter'[What is bin size] )
            ) = 0
                && NOT (
                    ISEMPTY (
                        FILTER (
                            param_Segment,
                            NOT ( ISBLANK ( 'Annual Income'[Value1] ) )
                                && param_Segment[Min] < 'Annual Income'[Value1]
                                && param_Segment[Max] >= 'Annual Income'[Value1]
                        )
                    )
                )
        )
    )
    

    Get the correct result.

    I attach my sample below for your reference.

     

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

    Best regards,

    Community Support Team_yanjiang