Forum Discussion

Harish85's avatar
Harish85
Helper III
8 months ago
Solved

how to apply range between string type data

Hi All,   I want to apply between or range between the data (C240000001 to C246000216) as there is more than 250000 data, I want to apply range and pull the data. How to apply range for above valu...
  • Olufemi7's avatar
    8 months ago

    Hello Harish85

    Power BI treats IDs like C240000001 as text, so you can’t use a Between slicer directly.

    To apply a numeric range filter, you need to extract the numeric portion and convert it to a number.

    Option 1: Power Query (Pre-filter before loading)

    • Go to Transform Data.

    • Add a Custom Column: 

    Number.FromText(Text.Middle([ID], 1, Text.Length([ID]) - 1))

     

    • Rename the column to ID_Number.

    • Apply a filter:

      • ID_Number >= 240000001

      • ID_Number <= 246000216

    • Load the filtered data into your report.

    This is best for large datasets because it filters before import.

    Option 2: DAX Calculated Column (Interactive filtering)

    • In your report view, create a new column:

    ID_Num = VALUE(MID([ID], 2, LEN([ID]) - 1))

     

    • Add a Slicer visual.

    • Drag ID_Num into the slicer.

    • Change slicer type to Between.

    • Set the range: 240000001 to 246000216.

    This is best for keeping all data and filtering interactively.


    Column Naming Convention (Power BI)

    To avoid confusion when using both Power Query and DAX in the same report, I recommend this naming:

    • Power Query → ID_Number (created during data load; used for filtering before import)

    • DAX → ID_Num (created in report layer; used for interactive filtering)

    Outcome Your slicer will show a horizontal slider with two handles, allowing users to filter between any numeric range of IDs.

    This works perfectly with either ID_Number (Power Query) or ID_Num (DAX).


    This approach ensures you can handle 250k+ rows efficiently while keeping your report interactive and professional.

    Table VisualBetween-Styled Slicer for ID_NumberBetween-Styled Slicer for ID_Num