Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Slicer / Filter exception

Hi guys, I'm new in PBI, I'm looking for ways to have a condition in filter. I have these slicers with type: sedan, hatchback, truck and I have 2 line chart: - Hatchback and Sedan - Truck No...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    You can create two measures separately. When the slicer selects Truck, the display related to Truck is displayed. When the slicer selects Truck and Sedan, the display related to Truck and Sedan is displayed. I don't know what the result of your specific condition judgment is. To define the rules, you can replace the judgment result in the following function:

    Measure =
    var _select=SELECTCOLUMNS('Car type',"1",'Car type'[CarType])
    return
    IF(
        "Truck" in _select&& NOT("Sedan" in _select),
        SUM('hatchback and Sedan'[SumDuration]),0
        )
    Measure 2 =
    var _select=SELECTCOLUMNS('Car type',"1",'Car type'[CarType])
    return
    IF(
        "Truck" in _select&& "Sedan" in _select,
        SUM('Truck'[SumDuration]),0
        )

     

    Best Regards,

    Liu Yang

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