# DAX - filter based on measure results

#### sassaboss

##### New Member
Hello,
I wish to calculate percent of change from month to month and to automatically return values only with fulfilled conditions.
Can I do all that using just DAX.
My thinking is something like this.
I have May and April for example. And columns with Date, Product_Name and Product_Sales.
Tot_SUM := sum(Table[Product_Sales])
SUM_PrMonth := CALCULATE( [Tot_SUM] ; PREVIOUSMONTH( Table[Date] ))
Percent_Change := Tot_SUM / SUM_PrMonth - 1

And in slicer I will choose month. Now, I want to show in table in Power BI only rows with product names where Percent of change is less than -20% and greater than 20%.
I tried with a given formula but unfortunately not very successful.
Measure := CALCULATE( [Tot_SUM]; FILTER( Table; [Percent_Change] < 0,2 && [Percent_Change] > 0,2 ))

### Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use \$ signs: \$V\$2:\$Z\$99 will always point to V2:Z99, even after copying

#### Matt Allington

##### MrExcel MVP
Well, you can do it easily using the filter pane on the right of the report canvas. Just drag the measure as a new filter (on the visual, or the page) and set the filter as you please.

if you want to use DAX, you need to fix your code

Measure := CALCULATE( [Tot_SUM]; FILTER( Table; [Percent_Change] < -0,2 || [Percent_Change] > 0,2 ))

#### sassaboss

##### New Member
Well, you can do it easily using the filter pane on the right of the report canvas. Just drag the measure as a new filter (on the visual, or the page) and set the filter as you please.

if you want to use DAX, you need to fix your code

Measure := CALCULATE( [Tot_SUM]; FILTER( Table; [Percent_Change] < -0,2 || [Percent_Change] > 0,2 ))
Great
I just realised that I used && and had a lot of problems. Thanks.
I will try to do that will filter pane also.

Many thanks for the answer.

Replies
1
Views
108
Replies
2
Views
58
Replies
0
Views
77
Replies
1
Views
85
Replies
1
Views
157