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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.