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
1125NEWBIUSER
Helper I
Helper I

DAX to filter values greater than 0 not working

Evening,

 

I am writting a DAX code to create a field that will mimic what I am doing with filters in a table. I have the DAX below and based on what I know, not sure why it is not working. I am getting a much different value. Below is also the current table with filters and the new field created with value from the DAX formula. Any advice to what I am doing wrong? Would appreciate any help. Thanks, Chris

1125NEWBIUSER_1-1664512940880.png

 

1125NEWBIUSER_0-1664512907732.png

 

8 REPLIES 8
tamerj1
Super User
Super User

Hi @1125NEWBIUSER 
Please try

Retail HI Undelivered =
SUMX (
    FILTER (
        'Sycle All Invoice',
        'Sycle All Invoice'[Net Price] > 0
            && 'Sycle All Invoice'[Sales Type] = "Hearing Aid"
            && 'Sycle All Invoice'[Market] = "Retail"
            && 'Sycle All Invoice'[Date Delivered] = BLANK ()
    ),
    'Sycle All Invoice'[Net Price]
)

I adjusted to this formula and still am can not tie to the manual table with filters. Below are new results.

Thanks, Chris

1125NEWBIUSER_0-1664547248229.png

 

Hi @1125NEWBIUSER 

are you sure the number in the table is correct?

Hi,

Yes, I am sure the data or total is correct. I was able to manually filter to this in excel with the raw data. I also did this same formula without the >0 part of the filter and adjusted my table without this and was able to get this data to tie out. I am just not able to get the filter to only show the no delivery date or undelivered totals I am looking to achieve. Below is without the >0 filter in and you can see the formula works for this. Something about the filtering on the net price >0 is causing my problem in the Dax.

1125NEWBIUSER_0-1664560999787.png

 

Hi @1125NEWBIUSER 

Thanks for reaching out to us.

I cannot reproduce this problem, could you share a sample .pbix file? thanks.

 

 

Best Regards,

Community Support Team _Tang

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

Hi @v-xiaotang ,

 

I figured out why the DAX was not working but cannot figure out how to code around it. The DAX is actually working and removing every line with a negative value, the problem is i need it to remove negative values at a subtotal level, when the invoice level totals negative, not each line. Example, visual below, when someone purchases, then cancels, it is the same invoice line but two transactions. One for purchase, one for cancel to remove value. In total, this is zero but with DAX, it removes the transaction level of just cancel making the value actually jump up when i remove negative DAX. Below is an imagine of what I see with data at detail of raw data level. Thanks, Chris

 

1125NEWBIUSER_0-1665863611068.png

 

ReneMoawad
Resolver III
Resolver III

Hi Chris,

 

I suggest you create a new column instead of the measure since all the filters used are from the same table

Retail HI Undelivered = 
IF(
    'Sycle All Invoice'[Net Price] > 0

    && 'Sycle All Invoice'[Sales Type] = "Hearing Aid"

    && 'Sycle All Invoice'[Market] = "Retail"

    && 'Sycle All Invoice'[Date Delivered] = BLANK()

    , 'Sycle All Invoice'[Net Price]

    , 0

)

 

after that you can do the sum of this new column

Hello,

I created the column using the DAX above and put into table and have this next to the table with field filters. It is coming up with different values still. I am not sure why this is not working but getting similar results to what I had with the calculated field Dax. Below are the results. Thanks again, Chris

1125NEWBIUSER_1-1664548045866.png

 

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.