Forum Discussion

prakash11440278's avatar
prakash11440278
Post Prodigy
5 years ago
Solved

Total value in Slicer

Hi Team,   I want to add the Global value in existing slicer, if the user select Global filter, need to display sum of all the region data. I dont want to add the Global value in existing table in ...
  • AllisonKennedy's avatar
    5 years ago

    prakash11440278 Another option is to create a new DimSlicer table: 

     

    Region Name

    North America

    Latin America and Asia Pacific

    Africa and Middle East

    Global

     

    put this in a slicer. 

     

    Create a new measure: 

     

    Global Measure = SWITCH(DimSlicer[Region]

    , "Global", CALCULATE( [Measure], ALL())

    , CALCULATE( [Measure], Table[rnr_name] = SELECTEDVALUE(DimSlicer[Region]))

    )

     

    and use that in your visuals. Make sure the DimSlicer table is not related to any table in your data model and this should work.

  • v-xulin-mstf's avatar
    5 years ago

    Hi, prakash11440278 

    Depend on your need, I suggest you to do as below processes:

    1.According to your actual data, I create a table as below:

    2.According to your expected data, I create a table as below:

    3.Create two measures as:

    _id =
    SWITCH (
        SELECTEDVALUE ( 'slicer table'[rnr_name] ),
        "Global"CALCULATE ( MAX ( 'Table1'[rnr_id] )ALL () ) + 1,
        CALCULATE (
            MAX ( 'Table1'[rnr_id] ),
            FILTER ( 'Table1', 'Table1'[rnr_name] IN FILTERS ( 'slicer table'[rnr_name] ) )
        )
    )

    sum_region data =
    SWITCH (
        SELECTEDVALUE ( 'Slicer Table'[rnr_name] ),
        "Global"CALCULATE ( SUM ( Table1[region data] )ALL ( Table1 ) ),
        CALCULATE (
            SUM ( Table1[region data] ),
            FILTER ( 'Table1', 'Table1'[rnr_name] IN FILTERS ( 'slicer table'[rnr_name] ) )
        )
    )

    4.Drag columns into visuals.

     

    Here is the demo, please try it: Total value in Slicer.pbix

    Best Regards,

    Link Chen

     

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