Forum Discussion
JJ51
4 years agoFrequent Visitor
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...
- 4 years ago
Hi JJ51
Here is a sample file with the solution https://www.dropbox.com/t/X2AzilJNQyYDLliOYou 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 ResultThe the measure would be
Count = DISTINCTCOUNT ( Changelog[Issue #] )
tamerj1
4 years agoCommunity Champion
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
ResultThe the measure would be
Count = DISTINCTCOUNT ( Changelog[Issue #] )JJ51
4 years agoFrequent Visitor
Thank you! The calculated column did exactly what I needed. However, I substituted the entire NumberOfChanges variable for the measure. The measure was also changed to just a count of Issue# in the Changelog, and due to a relationship between the the two tables (Issue #)