Forum Discussion
DAX expression, need suggestion
Hi all,
I have theese two tables with no relationship:
Table1 Table2
I have calculated Max and Min measures for the Value column and the measure IntervalGap which is Max-Min/15
Max = MAX(Table1[Value]) Min = MIN(Table1[Value]) IntervalGap= (Max-Min)/15
I would like to count how many values of Value column (Table1) belong to each of 15 intervals (from Min to Max with step IntervalGap) creating a measure or a calculated column to add in table2 where in the Index column are listed the fifteen intervals
Index column 1 represents the interval from Min to Min+IntervalGap
Index column 2 represents the interval from Min+IntervalGap to Min+2*IntervalGap
...
How can I achieve this goal with a DAX expression?
Thanks in advance for any clue!
OK, here is what I am thinking in Table2:
Column = VAR __low = IF([Index]=1,[MinMeasure],[MinMeasure]+([Index]-1)*[IntervalGapMeasure]) VAR __high= IF([Index]=15,[MaxMeasure],[MinMeasure]+[Index]*[IntervalGapMeasure]) RETURN COUNTX(FILTER('Table1',[Value]>=__low && [Value]<=__high),[Scenario Number])May need tweaking but something along these lines I believe.
5 Replies
- Greg_Deckler
Community Champion
Not really following this. Sample data that can be copied and pasted always helps. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490. What is the relationship between those two tables?
- laciodrom_80
Helper IV
- Greg_Deckler
Community Champion
OK, here is what I am thinking in Table2:
Column = VAR __low = IF([Index]=1,[MinMeasure],[MinMeasure]+([Index]-1)*[IntervalGapMeasure]) VAR __high= IF([Index]=15,[MaxMeasure],[MinMeasure]+[Index]*[IntervalGapMeasure]) RETURN COUNTX(FILTER('Table1',[Value]>=__low && [Value]<=__high),[Scenario Number])May need tweaking but something along these lines I believe.
- AnonymousNot applicable
I'm also a little bit lost reading your post.
Can you provide sample data?