Forum Discussion

hawb's avatar
hawb
Icon for Helper I rankHelper I
5 years ago
Solved

Creating Dynamic Equal Bins (using percentile.inc)

  1.) I have a table containing columns for Fish Species and Length. e.g. Bluegill 7.7 Bluegill 8.2 Bluegill 13.2 Crappie 7 Crappie 8.2 Crappe 10.3   2.) I want to be able to generate a col...
  • V-lianl-msft's avatar
    5 years ago

    Hi hawb ,

     

    Try this:

    Bucket = 
    VAR N = 5
    VAR Percentiles =
        ADDCOLUMNS (
            GENERATESERIES ( 1, N ),
            "Percentile", PERCENTILEx.INC ( FILTER('Table',EARLIER('Table'[Fish Species])='Table'[Fish Species]),'Table'[Length. e.g], [Value] / N )
        )
    RETURN
        MINX ( FILTER ( Percentiles, 'Table'[Length. e.g] <= [Percentile] ), [Value] )

     

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