cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

filtering a calculated / temporary table to generate a histogram

hello all

 

i have created a variable that stores a table which i then use to calculate some parameters that arent native in my raw tables. up until now, all of my measures referencing this temporary table have been working well. the trouble comes when i try to filter these calculated data points with some criteria in order to create a histogram on the data. 

 

everything i have learned about calculate and filtering doesnt appear to be working. I have tried multiple approaches and they have both failed. 

 

i have defined separate measures for the upper and lower ranges of each bin, which i am using to define the intervals ([MinBoundary] and [MaxBoundary]) from a separate table (bintable). both appear to be flowing through as expected. 

 

Method 1:

=

VAR Temp_Table =

SUMMARIZE(original table, original table [Sim_Run], "new column name", expression)

RETURN

calculate(countrows(Temp_Table,FILTER(Temp_Table,[new column name] >= bintable[Min_Boundary] && [new column name] < bintable[Max_Boundary]))

 

Method 2:

=

VAR Temp_Table =

SUMMARIZE(original table, original table [Sim_Run], "new column name", expression)


VAR Temp_Table_II =

CALCULATETABLE(Temp_Table,filter(Temp_Table,[new column name]>=bintable[Min_Boundary]) && [new column name]<bintable[Max_Boundary])

RETURN

CALCULATE(COUNTROWS(Temp_Table_II))

 

as you can see below, neither methods properly categorizes each row value of "new column name" located in the temporary table. in the example below, i have 3 sims (i.e. final values) that i want sorted in the appropriate bin. i am expecting to see each sim show up only once in one of the mutually exclusive bins. however, power pivot appears to not acknowledge any of the filters that i apply. how rude 🙂

 

image.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: filtering a calculated / temporary table to generate a histogram

thank you for referencing the helpful series of articles. after going through them and working on this issue some more, i was able to stumble across a working solution: 

 

the tweak i made that worked is the following

 

=

VAR Temp_Table =

SUMMARIZE(original table, original table [property i am using to count across], "new column name", expression)

RETURN

 

countrows(filter(Temp_Table,FILTER(Temp_Table,[new column name] >= bintable[Min_Boundary] && [new column name] < bintable[Max_Boundary]))

 

this small tweak was all i needed. 

View solution in original post

3 REPLIES 3
Highlighted
Super User V
Super User V

Re: filtering a calculated / temporary table to generate a histogram

Hi,

Your question is not clear.  Share some data, describe the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Highlighted
Super User IX
Super User IX

Re: filtering a calculated / temporary table to generate a histogram

Highlighted
Frequent Visitor

Re: filtering a calculated / temporary table to generate a histogram

thank you for referencing the helpful series of articles. after going through them and working on this issue some more, i was able to stumble across a working solution: 

 

the tweak i made that worked is the following

 

=

VAR Temp_Table =

SUMMARIZE(original table, original table [property i am using to count across], "new column name", expression)

RETURN

 

countrows(filter(Temp_Table,FILTER(Temp_Table,[new column name] >= bintable[Min_Boundary] && [new column name] < bintable[Max_Boundary]))

 

this small tweak was all i needed. 

View solution in original post

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors