Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to create Bucket in PowberBI

Dear,

 

I would like to create a bucket/slicers table (see bellow)

 

Thank you. 

 

 

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous 

    You can use EnterData and calculated column to achieve your goal.

    I build two tables to have a test.

    Rev Table:

    Slicer Table:

    Add a calculated column in Slicer Table.

    Virtual Bracket Granted = 
    VAR _MINK =
        DIVIDE ( Slicer[Min], 1000 ) & "" & "k€"
    VAR _MAXK =
        DIVIDE ( Slicer[Max], 1000 ) & "" & "k€"
    RETURN
        IF (
            Slicer[Max] = BLANK (),
            COMBINEVALUES ( "-", _MINK, BLANK () ),
            COMBINEVALUES ( "-", _MINK, _MAXK )
        )

    Result:

    Then build a measure in Rev Table.

    Measure = 
    VAR _Select =
        SELECTEDVALUE ( Slicer[Virtual Bracket Granted] )
    VAR _Min =
        CALCULATE ( SUM ( Slicer[Min] ), Slicer[Virtual Bracket Granted] = _Select )
    VAR _Max =
        CALCULATE ( SUM ( Slicer[Max] ), Slicer[Virtual Bracket Granted] = _Select )
    VAR _Revenue =
        SUM ( 'Rev'[Revenue] )
    RETURN
        IF (
            _Max = BLANK ()
                && _Revenue >= _Min,
            _Revenue,
            IF ( _Revenue >= _Min && _Revenue < _Max, _Revenue, BLANK () )
        )

    Result:

    You can download the pbix file from this link: How to create Bucket in PowberBI

     

    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. 

4 Replies