Forum Discussion

Jtbonner1986's avatar
Jtbonner1986
Icon for Helper I rankHelper I
1 year ago
Solved

Filtering and grouping by bucket

Hi All, Not sure what to call this so apologies for the titles   I have a materials Table with the number of months cover that material has. inside the materials table is a column identfying the n...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Jtbonner1986 

     

    Sorry for misunderstanding you, thanks for your explanation. You don't need to show "Nothing" value in the expected result, right?

     

    I hope the following test can help you.

     

    1. Execute "Unpivoted Columns" in Transform data (Power Query)

     

    Select the Material and Months Cover columns, then Transform -> Unpivoted columns -> Unpivoted other columns

     

    Close & Apply

     

    2. Create a calculated table

     

    Slicer = VALUES('Table'[Months Cover])

     

     

    no relationship between two tables

     

    3. Create a measure

     

    Measure = 
    VAR _selected = SELECTEDVALUE(Slicer[Months Cover])
    RETURN
    IF(MAX('Table'[Months Cover]) <= _selected && LEFT(MAX('Table'[Attribute])) = LEFT(_selected) && MAX('Table'[Value]) <> "Nothing", 1, 0)

     

     

    Output:

     

    If you need to display all values ​​when no slicer is selected, you can modify the measure:

    Measure = 
    VAR _selected = SELECTEDVALUE(Slicer[Months Cover])
    RETURN
    IF(_selected = BLANK(), 1, IF(MAX('Table'[Months Cover]) <= _selected && LEFT(MAX('Table'[Attribute])) = LEFT(_selected) && MAX('Table'[Value]) <> "Nothing", 1, 0))

     

    Output:

    Best Regards,
    Yulia Xu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.