Forum Discussion
Dynamic Buckets based on slicer
- Anonymous8 months ago
Hi vikash_X_Sinha ,
Thank you for reaching out to the Microsoft Fabric Community Forum.
Dynamic buckets cannot be created using calculated columns because calculated columns are evaluated during model refresh and cannot react to slicers. That is why your SELECTEDVALUE() logic does not work.
To implement dynamic Min/Max/Bin logic, you will need a pre-generated Bucket table (covering the maximum possible bin ranges), and then use measures to calculate the bucket labels and summary values based on slicer selections.
Create a supporting Bucket table (covers all possible values):
Buckets = GENERATESERIES ( 1, 2000000, 1 ) Create a Bucket Range measure:
Bucket Label = VAR MinBal = SELECTEDVALUE(MinBalance[Value], 0) VAR MaxBal = SELECTEDVALUE(MaxBalance[Value], 0) VAR Bin = SELECTEDVALUE(BinSize[Value], 0) VAR Current = MAX(Buckets[Value]) RETURN IF ( Current >= MinBal && Current <= MaxBal, FORMAT( FLOOR((Current - MinBal) / Bin, 1) * Bin + MinBal, "0") & " - " & FORMAT( (FLOOR((Current - MinBal) / Bin, 1) * Bin) + Bin + MinBal, "0" ), BLANK() ) Create your value measure (e.g. count or sum):
Total Amount in Bucket = VAR Label = [Bucket Label] RETURN IF(NOT ISBLANK(Label), SUM(Fact[Amount])) Place this in your bar chart on X-axis → Bucket Label (measure) and on Y-axis → Total Amount in Bucket (measure) now apply slicers for Min, Max, and Bin Size.
If it's still doesn't work please share a small sample dataset and the expected bucket output. I can then create the exact DAX and PBIX structure for your scenario.
Thank you.
Hi vikash_X_Sinha ,
We haven’t received an update from you in some time. Could you please let us know if the issue has been resolved?
If you still require support, please let us know, we are happy to assist you.
Thank you.