Forum

How to filter a mea...
 
Notifications
Clear all

How to filter a measure

6 Posts
4 Users
0 Reactions
1,413 Views
(@the-fred)
Posts: 3
Active Member
Topic starter
 
Note - this is a cross post from Mr Excel as I haven't has a response.
 
I just cannot work out how to do this so any help would be appreciated.

I have an account table (dim table): account name, start date, end date.
The user chooses a year using a disconnected 'year' slicer.
A measure [account status] calculates whether the account is 'active' or 'inactive' depending on the choice of 'year'.

This all works properly.

How do I create a report table showing only the 'active' accounts?

I have tried a powerpivot table with account name, start date and end date in the row field, and the [account status] in the 'values' field, but I cannot filter 'values' to only show 'active' (using the 'values filter' in the rows filed does not work with text, and I would prefer to use a slicer rather than the user having to faff around with filters on a pivot table).

Should I be using a powerpivot table or a different method?

Thanks

 
 
 
Posted : 02/07/2022 1:58 am
Riny van Eekelen
(@riny)
Posts: 1219
Member Moderator
 

You omitted to add a link to your post on MrExel. Found it and added it below so that people answering on this forum can check if an answer has come in before spending time on it.

https://www.mrexcel.com/board/threads/how-to-filter-a-measure.1209081/

It would be very helpful if you could share a file with some sample data, the measure and the pivot table.

 
Posted : 02/07/2022 2:26 am
(@the-fred)
Posts: 3
Active Member
Topic starter
 

@Riny Thanks for adding the link. I meant to do that but forgot. I have attached an example file so hopefully it helps with the question.

 
Posted : 04/07/2022 12:39 am
Riny van Eekelen
(@riny)
Posts: 1219
Member Moderator
 

Why not use 1 and 0 to mark an account as Active and Inactive. Then you can filter Active accounts by selecting 1.

 
Posted : 04/07/2022 2:23 am
Anders Sehlstedt
(@sehlsan)
Posts: 974
Prominent Member
 

Hello Fred,

Not sure if this is a good approach in the long run, but at least it works with this small amount of data, even though you have to update the data for every change. Take a look at the file and see if this little cheat trick does the job for you.

Br,
Anders

 
Posted : 05/07/2022 4:08 pm
(@debaser)
Posts: 838
Member Moderator
 

You could use a measure just for active sales - eg

 

=CALCULATE([Total sales],FILTER(dimAccounts,[Year selected]>=max(dimAccounts[Year - start date])
&&[Year selected]<=max(dimAccounts[Year - end date])))

 
Posted : 06/07/2022 5:51 am
Share: