Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Value between two columns

I have a table that contains FROM and THROUGH serial number (not date) range values for a product line. I would like to build a slicer that will find all rows where the input value with BETWEEN the ...
  • OwenAuger's avatar
    OwenAuger
    5 years ago

    Hi Anonymous 

    EDIT: Forgot the attachment - just attached it!

    Thanks for testing this out!

     

    After looking at your overall requirements, I think this is a good candidate for a Calculation Group, with a Calculation Item that applies the range filter to the parts .

    When the Calculation Item is applied as a filter, the "range" filter will be applied to any measures used in the visuals.

     

    I have attached an updated PBIX, with a PartChild table added (hopefully similar to yours).

     

    1. The first thing I did was create a Calculation Group called Parts Filter, with a single column Parts Filter, with a Calculation Item Parts in Range. This Calculation Item is defined as

     

    VAR MinValue =
        MIN ( Range[Value] )
    VAR MaxValue =
        MAX ( Range[Value] )
    RETURN
        CALCULATE (
            SELECTEDMEASURE (),
            'Product'[FROM] <= MaxValue,
            'Product'[THROUGH] >= MinValue
        )

     

    If you haven't created Calculation Groups before, you'll need Tabular Editor. See here for example.

     

    2. Next I applied a Page filter, selecting Parts Filter = "Parts in Range".

     

    3. Then I ensured that all visuals use explicit measures, namely:

     

    Part Count = 
    COUNTROWS ( 'Product' )
    
    Child Count = 
    COUNTROWS ( PartChild )

     

     

    4. The above measures work fine on cards/pie charts. However table visuals with no measures displayed need a have a measure injected somehow. I chose to apply a visual level filter of Part Count is not blank to the table visuals, which is modified by the Calculation Gruop.

     

    What do you think of this method? I think it simplifies applying the range filter and saves writing multiple measures with the same filter.

     

    Regards,

    Owen