Forum Discussion
How to create Bins for a Quick Measure?
- 5 years ago
Hi, Anonymous
According to your requirement, I guess that your understanding of the tree map is not very clear. The tree map is used to visually display the proportion of the number of certain members to the whole. If you put this label field in the tree map, It only displays the count of this item you selected. I suggest you use two Card charts to display separately the tag of [Billed Amt] and [TX], and it will visually display tags of the [Account Number] you selected, you can try these measures:
Monthly Billed Amt Bins = var _total_avg=CALCULATE( AVERAGE('Master'[Total_Billed_Amount]),ALLEXCEPT('Master','Master'[Account_Number])) var _result= SWITCH( TRUE(), _total_avg<26,"Up to $25" ,_total_avg<51,"$26-$50" ,_total_avg<76,"$51-$75" ,_total_avg<101,"$76-$100" ,_total_avg<126,"$101-$125" ,_total_avg<151,"$126-$150" ,_total_avg<201,"$151-$200" ,_total_avg<251,"$201-$250" ,_total_avg<301,"$251-$300" ,_total_avg<501,"$301-$500" ,"$501+") return _resultMonthly Transaction Bins = var _total_avg=CALCULATE( AVERAGE('Master'[Total_Units_of_Transaction]),ALLEXCEPT('Master',Master[Account_Number])) var _result= SWITCH( TRUE(), _total_avg<6,"Up to 5 TX" ,_total_avg<11,"6-10 TX" ,_total_avg<21,"11-20 TX" ,_total_avg<41,"21-40 TX" ,_total_avg<61,"41-60 TX" ,_total_avg<81,"61-80 TX" ,_total_avg<101,"81-100 TX" ,_total_avg<121,"101-120 TX" ,_total_avg<201,"121-200 TX" ,"200+ TX") return _resultAnd you can get what you want, like this:
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
According to your requirement, I guess that your understanding of the tree map is not very clear. The tree map is used to visually display the proportion of the number of certain members to the whole. If you put this label field in the tree map, It only displays the count of this item you selected. I suggest you use two Card charts to display separately the tag of [Billed Amt] and [TX], and it will visually display tags of the [Account Number] you selected, you can try these measures:
Monthly Billed Amt Bins =
var _total_avg=CALCULATE(
AVERAGE('Master'[Total_Billed_Amount]),ALLEXCEPT('Master','Master'[Account_Number]))
var _result=
SWITCH(
TRUE(),
_total_avg<26,"Up to $25"
,_total_avg<51,"$26-$50"
,_total_avg<76,"$51-$75"
,_total_avg<101,"$76-$100"
,_total_avg<126,"$101-$125"
,_total_avg<151,"$126-$150"
,_total_avg<201,"$151-$200"
,_total_avg<251,"$201-$250"
,_total_avg<301,"$251-$300"
,_total_avg<501,"$301-$500"
,"$501+")
return _result
Monthly Transaction Bins =
var _total_avg=CALCULATE(
AVERAGE('Master'[Total_Units_of_Transaction]),ALLEXCEPT('Master',Master[Account_Number]))
var _result=
SWITCH(
TRUE(),
_total_avg<6,"Up to 5 TX"
,_total_avg<11,"6-10 TX"
,_total_avg<21,"11-20 TX"
,_total_avg<41,"21-40 TX"
,_total_avg<61,"41-60 TX"
,_total_avg<81,"61-80 TX"
,_total_avg<101,"81-100 TX"
,_total_avg<121,"101-120 TX"
,_total_avg<201,"121-200 TX"
,"200+ TX")
return _result
And you can get what you want, like this:
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks v-robertq-msft . I was also able to create two columns, in addition to measures, and use those columns for tree map. The script you provided works both ways. I was really having a hard time getting the averages right when using a column vs. measure. Your code seems to work great for a measure and columns.
Thank you.