Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DB_476
Regular Visitor

Create Bins of Calculated Measures then Visualize them with Slicers

I have a fun story problem that has proven more challenging than it may seem.  I am evaluating two different types of environmental "monitor" equipment that are placed for a period of time at the same "site" and then moved.  Each peice of equipment has different sensors but they are supposed to produce the same "record".  Each type of record has a set value of integer "points" associated with it.  There is a 1:1 relationship between the record" and the points it is worth (e.g. Record "H1" is worth 1 point regardless of site or monitor).  But each record has varying levels of decimal "concentration" associated with it.

 

I need to do a few simple comparisons:

  1. Calculate, chart, then compare the percentage difference for total number of points that each monitor recorded per site (No problem!)
  2. Group those point totals into bins (Slightly more challenging to bin the results of a measure, but can be done.)
  3. Calculate, chart, then compare the percentage difference for total count of sites in each bin for each monitor (I'm stuck here.)

...here's the rub, I need to be able to do all the above and maintain the full functionality of slicers to see how they adjust the point sums and bin counts on-the-fly.  For example, I need to be able to select only certain records, within a certain concentration range, and see how it changes the sums and counts.

 

Here is a sample of my data (it really does come as one large file):

SiteIDMonitorRecordConcentrationPoints
ABC123ClassAlphaH10.2070588361
ABC123ClassAlphaP30.6096663313
ABC123ClassAlphaH20.2324136642
ABC123BetaModelR60.0567513794
ABC123BetaModelJ90.2694088063
ABC123BetaModelS80.6662128481
ABC123BetaModelH60.6680407012
LMN456ClassAlphaQ40.9711433341
LMN456ClassAlphaP80.058535744
LMN456BetaModelH60.1738828952
LMN456BetaModelH80.8392646542
LMN456BetaModelJ80.4377785533
XYZ789ClassAlphaS80.9715536331
XYZ789ClassAlphaH80.1945242772
XYZ789ClassAlphaP30.9182715843
XYZ789ClassAlphaP50.5669515843
XYZ789BetaModelJ10.8242009625
XYZ789BetaModelQ70.8473827644

 

Here is the table I can easily make:

SiteBetaModel_PointSumClassAlpha_PointSumPercentage Difference
ABC1231061.66
LMN456751.4
XYZ789991

 

Here is the desired output I cannot make:

BinName_RangeOfPointSumsBetaBinCountAlphaBinCountPercentage Difference
<5000%
5-1023150%
10-1510-100%
15-20000%
20-25000%

...and I need to be able to chart and slice all of the above to see the effects on sums and bin counts.

 

Thanks very much in advance!

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @DB_476 ,

 

Firstly, you need to create a table that holds your Bin names and Bin ranges.

bin-range.PNG

Then create a measure to sum the points

Total points = CALCULATE(SUM('Table'[Points]),FILTER(ALLEXCEPT('Table','Table'[SiteID]),'Table'[Monitor]="BetaModel"))

Create a measure based on the created bin range as a filter condition.

Measure = var test = IF(HASONEVALUE('Table (2)'[BIN_Range]), CALCULATE(DISTINCTCOUNT('Table'[SiteID]),
FILTER('Table',[Total points]>=VALUES('Table (2)'[Min_value])&& 
[Total points]<VALUES('Table (2)'[Max_value])&&
'Table'[Monitor]="BetaModel" ) ),
DISTINCTCOUNT('Table'[SiteID]))
return IF(ISBLANK(test),0,test)

test_Create Bins of Calculated Measures then Visualize them with Slicers.PNG

 

Sample .pbix

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
V-lianl-msft
Community Support
Community Support

Hi @DB_476 ,

 

Firstly, you need to create a table that holds your Bin names and Bin ranges.

bin-range.PNG

Then create a measure to sum the points

Total points = CALCULATE(SUM('Table'[Points]),FILTER(ALLEXCEPT('Table','Table'[SiteID]),'Table'[Monitor]="BetaModel"))

Create a measure based on the created bin range as a filter condition.

Measure = var test = IF(HASONEVALUE('Table (2)'[BIN_Range]), CALCULATE(DISTINCTCOUNT('Table'[SiteID]),
FILTER('Table',[Total points]>=VALUES('Table (2)'[Min_value])&& 
[Total points]<VALUES('Table (2)'[Max_value])&&
'Table'[Monitor]="BetaModel" ) ),
DISTINCTCOUNT('Table'[SiteID]))
return IF(ISBLANK(test),0,test)

test_Create Bins of Calculated Measures then Visualize them with Slicers.PNG

 

Sample .pbix

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.