Forum Discussion

Amrselim1989's avatar
Amrselim1989
Helper II
3 years ago

Calculate filter OR

Item Last Cost =
calculate(AVERAGE( Products[last_cost] ),
FILTER(Bi_Balance_All,not(ISBLANK([Units at Stock])))
||
FILTER(Bi_Basket_all,not(ISBLANK([Basket Uints]))))
 
what's wrong here?! why i can't use or with this code?!!

8 Replies

  • Hi,

    Share data in a format that can be pasted in an MS Excel file, explain the question and show the expected result.

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

        In the Query Editor, append the 2 tables (call that table Data).  Create a single column table with all unique Names (call this table Names).  Create a many to one relationship from the Data table and Product table to the Names table.  To your visual, drag Name from the Names table.  Write this measure

        Measure = if(sum(Data[Balance])=0,blank(),sum(Product[Price]))

        Hope this helps.

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi Amrselim1989 ,

    Try this kind of structure:

    Measure =
    calculate(AVERAGE( 'Table'[Value] ),
    FILTER('Table (2)',not(ISBLANK([Units at Stock]) || not(ISBLANK([Basket Uints])))))

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
    • Amrselim1989's avatar
      Amrselim1989
      Helper II

      no i can't the Basket Uints is coming from another table not table 2

       

      calculate(AVERAGE( 'Table'[Value] ),
      FILTER('Table (2)',not(ISBLANK([Units at Stock]) || "here must choose another table (not table 2)"not(ISBLANK([Basket Uints])))))
  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Amrselim1989 

    I can only assume based on your dax that both tables filter the Products table. If this is the case you can try

    =
    AVERAGEX (
    FILTER (
    Products,
    NOT ISBLANK ( RELATED ( Bi_Balance_All[Units at Stock] ) )
    || NOT ISBLANK ( RELATED ( Bi_Basket_all[Basket Uints] ) )
    ),
    Products[last_cost]
    )

  • I hope this message finds you well. I've noticed that this solution remain unresolved. If any of you have managed to find a resolution to the issue, I kindly request that you share your solution for the benefit of the entire community. Alternatively, if you're still facing challenges, please do let us know as well.

    Your insights and updates will greatly assist others who might be encountering the same challenge.