Forum Discussion

Disco2021's avatar
Disco2021
Frequent Visitor
5 years ago

slicer like measure

i have slicer ( column from separate table ) , and i written measure for slicer (formula through switch ) when i use slicer , i want that in my report table filtered data like my slicer choice, but in resuit i see all data in table and data like slicer choice.

slicer measure =
VAR diff =
COUNTROWS ( 'summary by  customer data' )
RETURN
IF (
HASONEVALUE ( 'select'[selections] ),
SWITCH (
TRUE (),
VALUES ( 'select'[select id] ) = 1
&& [dif by customer] < 0, diff,
VALUES ( 'select'[select id] ) = 2
&& [dif by customer] > 0, diff,
VALUES ( 'select'[select id] ) = 3
&& ISBLANK ( [dif by customer] ), diff
),
diff
)

 

2 Replies

  • selimovd's avatar
    selimovd
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hey Disco2021 ,

     

    I'm not really sure what you want to do. Can you maybe show us in Power BI what you want to do?

    Also your measure does not make much sense for me. In all cases you return diff. Then you can just write:

    slicer measure = COUNTROWS ( 'summary by  customer data' )

     

    Also a measure cannot be used to slice. I think you might need a calculated column with the values from "Slicer measure". This column you can then use as a normal slicer.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
  • v-xiaotang's avatar
    v-xiaotang
    Icon for Community Support rankCommunity Support

    Hi Disco2021 

    do you mean, when you choose 2 in slicer, then the left table visual should show the 2 rows including Measure=2?

    actually, desktop cannot filter measure directly, maybe we can take a workaround.

    could you share your sample file and expected result?

     

     

    Best Regards,

    Community Support Team _Tang

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