Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
LauritzPBI_O
Frequent Visitor

Help with filtering table based on filter string

I hope someone can help with this problem.

So I'm trying to create a DAX measure, that needs to filter some account numbers in a table based on a string.
The string contains both ranges and specific account numbers, and looks like this:
01011..01090|01901..01902|01904..01959|01980..01998 

I can then fetch that value in my measure with this variable:

VAR FilterString =
    CALCULATE(
        SELECTEDVALUE( 'Account Schedule'[Totaling]),
        'Account Schedule'[Row No_] = "01090"
    )

However, how do i then translate that string into a useable filter?

5 REPLIES 5
tamerj1
Super User
Super User

Hi @LauritzPBI_O 

would you please clarify a bit more. Which column is which. Would be great if you could provide some sample data along with the expected result. 

Hey thanks for looking into it!
I couldn't seem to attach a file here, so I've made the simplified dataset as a table here.
So ideally I need to sum the values in the "Amount" column, but only for the accounts in "AccountNo" column, that has to be filtered by the filterstring.

AccountNoAmount
01001100
01005100
01010100
01020100
01021100
01022100
01023100
01024100
01025100
01026100
01027100
01028100
01029100
01030100
01031100
01032100
01033100
01034100
01035100
01037100
01039100
01080100
01085100
01090100
01100100
01105100
01110100
01115100

 

@LauritzPBI_O 

You may upload to any cloud or file transfer service and share the download link. 

Ahh my bad!

Here's a link for the example file, its a simple Excel file with two columns

https://www.dropbox.com/scl/fi/asyxrlaf1kr6tfgu9kkzp/Example_Accounts.xlsx?dl=0&rlkey=oqnjelwsff4pr1...

@LauritzPBI_O 
Apologies, perhaps I did not clarify my question. The sample data placed in your previous reply was just fine. However, the other table that contains the combination string was (and still) missing. 

I'm trying to match between your written description of the requirement and the measure/column that you have provided in order to completely understand what exactly do you have and what exactly are trying to accomplish.

The measure/column that you have provided in you original post says the following

VAR FilterString =
    CALCULATE(
        SELECTEDVALUE'Account Schedule'[Totaling]),
        'Account Schedule'[Row No_] = "01090"
    )
 
Now the sample data that you have provided contains two columns that are not part of you measure's DAX code! 
 
All that is requirement from your side is provide a clear description of your available inputs and the required output(s). Therefore I was asking for a sample PBIX file that contains samples of all involved tables and relationships (if any) along with measures/calculated columns and one hand written example that explains what are you trying to achieve.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.