Forum Discussion

Kent1341's avatar
Kent1341
Helper I
5 years ago

Selecting a value for a Line Chart

Hi! I hope that someone can help with this!

 

I'm trying to trick Power BI as the Line Chart cannot drill up and down in the hierarchy - At least that's what I think! 

 

The problem that I have is in the following:

 

 

VAR MyManu =
    SELECTEDVALUE( 'PRODUCT 2 (another product)'[Manufacturer],BLANK())
VAR MySubCat =
    SELECTEDVALUE( 'PRODUCT 2 (another product)'[Brand],BLANK())
RETURN
    CALCULATE (
        'Dynamic Fact'[FACT II],
        FILTER (
            ALL ( 'Product' ),
                && 'Product'[Brand] = MyBrand
                && 'Product'[Manufacturer] = MyManu
))

 

 

 

This works fine as long as there is a value in both selectors. When I choose more or nothing in the MyBrand selector it will not work. 

 

Br Kent

3 Replies

  • Kent1341 , You can try with this change

     

     

    VAR MyManu =
        values( 'PRODUCT 2 (another product)'[Manufacturer])
    VAR MySubCat =
        values( 'PRODUCT 2 (another product)'[Brand])
    RETURN
        CALCULATE (
            'Dynamic Fact'[FACT II],
            FILTER (
                ALL ( 'Product' ),
                    && 'Product'[Brand] in MyBrand
                    && 'Product'[Manufacturer] in MyManu
    ))

     

    Not sure on that will work as you want

    • Kent1341's avatar
      Kent1341
      Helper I

      Unfortunately not! ๐Ÿ˜ž

       

      The first one (selectvalue) dosenet write one, but this one (values) makes the line chart go into "Can't display the visual".

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI Kent1341,

        How did these two selection field value mapping? Can you please share some more detailed information to help us clarify your scenario? 

        How to Get Your Question Answered Quickly

        If they are filtered by two field values at the same time, you can't directly use 'in' operator to compare with your expressions. (e.g. filter 1: 'A,B,C', filter 2: '1,2,3,4', real record filter: 'A[1,2]', 'B[1,3]', 'C[1,4]')
        Regards,

        Xiaoxin Sheng