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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
fbittencourt
Helper III
Helper III

Filter positive and negative values separated from a column

 

 

What I need is  simple let me show:

fbittencourt_0-1739808186398.png

 

I need one calculated column or measure to retrive only the negative values = -8 and other column just with positive values  = 82

 

Disponibilité Restante = FAIT_INDICATEURS[DISPO] - FAIT_INDICATEURS[Charge] * calculated column
Dispo restante = sum(FAIT_INDICATEURS[DISPO])-sum(FAIT_INDICATEURS[Charge]) * mesure
 
I need to add to my mesure that is not working well the filter Id Ressource to retrieve negative values ( First mesure)
and other mesure only positive values ( second mesure)
 
I tried:

SURPLAN 7 = CALCULATE(SUMX(FILTER(FAIT_INDICATEURSFAIT_INDICATEURS[Disponibilité Restante]<0), FAIT_INDICATEURS[Disponibilité Restante]))  AND ALSO ADDING ID RESSOURCE but I have an error
 
2 REPLIES 2
Anonymous
Not applicable

Thanks for lbendlin's concern about this issue.

 

Hi, @fbittencourt 

Perhaps you changed DAX to the following DAX, hope that helps:

 

Measure to retrieve only negative values filtered by ID RESSOURCE:

SURPLAN_Negative = CALCULATE(
    SUMX(
        FILTER(
            FAIT_INDICATEURS,
            FAIT_INDICATEURS[Disponibilité Restante] < 0
        ),
        FAIT_INDICATEURS[Disponibilité Restante]
    ),
    FILTER(FAIT_INDICATEURS, FAIT_INDICATEURS[ID RESSOURCE] = [ID RESSOURCE])
)

 

Measure to retrieve only positive values filtered by ID RESSOURCE:

SURPLAN_Positive = CALCULATE(
    SUMX(
        FILTER(
            FAIT_INDICATEURS,
            FAIT_INDICATEURS[Disponibilité Restante] > 0
        ),
        FAIT_INDICATEURS[Disponibilité Restante]
    ),
    FILTER(FAIT_INDICATEURS, FAIT_INDICATEURS[ID RESSOURCE] = [ID RESSOURCE])
)

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Remember that MIN() and MAX() can take two parameters.

 

So to add up all the negative values use

 

SUM(MIN(FAIT_INDICATEURS[Disponibilité Restante],0))

 

and to sum up all positive values use

 

SUM(MAX(FAIT_INDICATEURS[Disponibilité Restante],0)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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