Forum Discussion

ybicalways79's avatar
ybicalways79
Frequent Visitor
3 years ago

DAX Measure to filter Multiple DataSets in Visuals - Power Bi

Ive been at this a week now with little progress and lot of frustration.

 

I have 2 slicers is my projects which are both shows here in the left corner.  When I select a Visual Category, I would like the cooresponding Sales by the related Route code.  Example, I click on "A Route Time" and the line in the graph only shows A routes.  I select "C Route Efficiency (72%)" and i see only sales for C Routes.  Now if i select "Open Pickups", I was to see a sum of all sales (A,B,C, Blank, etc).  Would anyone be able to show me the proper DAX functions and structure?

 

 

[Visual Category} is my table for my slicer

 

 

Here is a sample [Sales] table that has direct relationship to the table above based on Route.  Some route letters will not match example D, E or U.  Some will be blank.

 

 

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ybicalways79 ,

     

    I suggest you to remove or inactive the relationship between two tables. Then create measures to get result.

    Select Category Price = 
    VAR _SELECTEDALUE =
        SELECTEDVALUE ( 'Visual Category'[SalesRounteMatch] )
    RETURN
        IF (
            ISFILTERED ( 'Visual Category'[Matched Categories] ),
            IF (
                _SELECTEDALUE = BLANK (),
                CALCULATE ( SUM ( Sales[Price] ) ),
                CALCULATE ( SUM ( Sales[Price] ), Sales[Route] = _SELECTEDALUE )
            )
        )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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