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 IV
Super User IV

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 IV
Super User IV

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

@jhimelic , refer Segmentation can help
https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

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 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors
Top Kudoed Authors