Forum Discussion

ddpl's avatar
ddpl
Solution Sage
2 years ago

AllExcept & AllSelected...???

I have Matrix visual(Row: Seller, Column: Date Hierarchy) and 2 measures

1: Sold Unit Count

2: Sold Unit Count for Previous Day (using ALLEXCEPT( Tab, Tab[Seller] )

 

When I add any slicer(Product_Type, Region), I have to add those columns in AllExcept function of Previous Day Count Measure

 

What is another approach to address this, I know this sound lame that use AllExcept and AllSelected both...!!!

 

Any suggestion will help me alot.

5 Replies

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    ddpl 

     

     

    allexcept will remove the filters on everything from the table you give it as paramter, except the columns you specify

     

     

    allselected () when used in a simple measure , it disregards the filter coming from the visual, and keep the filters coming from the slicers or other visuals .

     

    so maybe you can use :  allselectedTab[Seller] ) .

    this will ignore the filter coming from the visual  but keep the filters coming from outside the visual

     

     

    another solution is removefilters (Tab[Seller]) which remove the filters only on seller  column . 

     

    the selection of the function to use depend on what you want to display. 

     

    hope this make sense to you ,

     

     

     

    If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. I would appreciate hitting that kudos 👍🫡

     

     

     

    • ddpl's avatar
      ddpl
      Solution Sage

      Daniel29195 Thanks for your reply

       

      but I think I'm missing something

       

      Here are my Measures

       

      ct = COUNTTab[Order_ID] )

       

      pre_ct =

      CALCULATE(
          LASTNONBLANKVALUE( Tab[Date], COUNT( Tab[Order_ID] ) ),
          ISAFTER( Tab[Date], MAX( Tab[Date] ), DESC ),
          ALLEXCEPT( Tab, Tab[Seller] )
      )
      • Daniel29195's avatar
        Daniel29195
        Community Champion

        ddpl 

         

        i suppose you want to remove the filter on date, 

        so why not using removefilters to remove filter on date, and thus all the other filter will remain . 

         

         

        pre_ct =

        CALCULATE(
            LASTNONBLANKVALUE( Tab[Date]COUNT( Tab[Order_ID] ) ),
            ISAFTER( Tab[Date]MAX( Tab[Date] ), DESC ),
            removefilters ( Tab[Date] ) 
        )

         

         

        If my response has successfully addressed your issue kindly consider marking it as the accepted solution! This will help others find it quickly. I would appreciate hitting that kudos 👍🫡