Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Amrselim1989
Helper II
Helper II

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 8
technolog
Super User
Super User

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.

Ashish_Mathur
Super User
Super User

Hi,

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Amrselim1989_0-1693290160185.png

 

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

i can't actullay do that, it's ver complicated cube with alot of relationships, i just tried to simplfy as mush as i can, but iused another measure 

 

VAR not_in_Scope = not(ISINSCOPE(Products[Item]))
Var Check_ = AND(ISBLANK(count(Bi_Balance_All[ProductID])),ISBLANK(count(Bi_Basket_all[MODEL_ID])))
return
if(Check_=TRUE() || not_in_Scope = True() ,blank(),AVERAGE(Products[last_cost]))

------------------------------------------------------------------------
VAR balance = CALCULATE(AVERAGE(Products[last_cost]), FILTER(Bi_Balance_All,not(isblank([Units at Stock]))))
 VAR basket = CALCULATE(AVERAGE(Products[last_cost]), FILTER(Bi_Basket_all,not(isblank([Basket Uints]))))
return
 if( isblank(balance) && isblank(basket),blank(),AVERAGE(Products[last_cost])),
 
they both worked, i juts can't imagine that i can't use or with calculate and filter?!!!!
tamerj1
Super User
Super User

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]
)

ValtteriN
Super User
Super User

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/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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])))))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.