Forum Discussion

JJ51's avatar
JJ51
Frequent Visitor
4 years ago
Solved

Create Categories Based On Count From a Measure

Hey all!   I'd like to preface by saying that I am mostly new to Power BI, not a programmer, and I am self-taught, so if this question seems obvious or is a standard practice, please forgive my ign...
  • tamerj1's avatar
    4 years ago

    Hi JJ51
    Here is a sample file with the solution https://www.dropbox.com/t/X2AzilJNQyYDLliO

    You nedd to have a calculated column

    Buckets = 
    VAR NumberOfChanges =
        COUNTROWS (
            CALCULATETABLE ( 
                Changelog,
                ALLEXCEPT ( Changelog, Changelog[Issue #] )
            )
        )
    VAR Result =
        SWITCH ( 
            TRUE(),
            NumberOfChanges IN { 1, 2, 3 }, "1-3",
            NumberOfChanges IN { 4, 5, 6 }, "4-6",
            NumberOfChanges IN { 7, 8, 9 }, "7-9",
            NumberOfChanges IN { 10, 11, 12 }, "10-12",
            NumberOfChanges IN { 13, 14, 15 }, "13-15",
            ">15"
        )
    RETURN
        Result

    The the measure would be

    Count = DISTINCTCOUNT ( Changelog[Issue #] )