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
YBZ
Helper III
Helper III

IF function measure

Hi all,

 

I am struggling with a measure as I would like to apply an IF condition.

 

I would like to sum up the costs, but IF Projects WBS starts with 'O.NO.XZZ', it should exclude the cost linked to GL Account A7.

 

When I however start with my IF function, I would like to refer to the column Project WBS, but it seems that I am only allowed to refer to a measure?

 

Project WBSGL accountCost 
O.NO.XZZ.123A7100
O.NO.XZZ.124A8200
P.NO.XZZA750
P.NO.XZZA770

 

Anybody could guide me to right direction ? 🙂

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @YBZ ,

 

Check this measure:

Measure = SUMX(ALL('Table'),'Table'[Cost])-SUMX(FILTER('Table',LEFT('Table'[Project WBS],8)="O.NO.XZZ"&&'Table'[GL account]="A7"),'Table'[Cost])

vjaywmsft_0-1666860098454.png

 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @YBZ ,

 

Check this measure:

Measure = SUMX(ALL('Table'),'Table'[Cost])-SUMX(FILTER('Table',LEFT('Table'[Project WBS],8)="O.NO.XZZ"&&'Table'[GL account]="A7"),'Table'[Cost])

vjaywmsft_0-1666860098454.png

 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
YBZ
Helper III
Helper III

thanks, I am actually still struggling with this one. Basically I would need to create the following measure : 

 

If Recharge project, it should sum up all actuals but EXCLUDE GL account A7995050. Otherwise, just sum up all actuals.

 

The second condition of my if statement works, but there is a problem with the first part.

 

Actuals YTD test = if(all('Mapping WBS'[Budget]) = "Recharge",calculate ( sum('Capex OC 1/2/3 Foundation (2)'[Actuals]), filter('current ytd period','current ytd period'[month current ytd period] <= MAX('current ytd period'[month current ytd period])),filter('Capex OC 1/2/3 Foundation (2)','Capex OC 1/2/3 Foundation (2)'[Cost Element (CE).Cost Element (CE) Level 01.Key (Not Compounded)] <> "A7995050"))
 , calculate ( sum('Capex OC 1/2/3 Foundation (2)'[Actuals]), filter('current ytd period','current ytd period'[month current ytd period] <= MAX('current ytd period'[month current ytd period])))))

 

 

jcalheir
Solution Supplier
Solution Supplier

Not sure what measure are you using, but if you want to sum the costs based on the condition you mentioned, do something like:

 

 

Your measure = 
CALCULATE(
    SUM('yourtable'[accountCost]),
    FILTER(
        Sales,
        LEFT(Sales[Project WBS],8) <> "O.NO.XZZ"
    )
)

 

 Kind regards,
José
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

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.