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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Calculated calculation based on logic

Account NameDateAmount
Rev12-Jun-18430
Exp13-Aug-17250
Margin2-Mar-170
Rev12 July 18400
Exp13-Aug-17300

 

I have a table where I need to create a calculated measure based on the below logic

 

If the Account Name <> 'Margin' then Sum of amount

if the Account Name = "Margin' then Sum of amount =

Sum of Amount when account name is 'Rev' -  Sum of Amount when account name is 'Exp'

 

Regards

Hitesh

1 REPLY 1
ibarrau
Super User
Super User

Hi. Can you explain a bit more your idea? i don't understand why <> marin or = margin both result in sum of amount. The third line should something like: (i think variables can help to get better undestanding)

VAR amount_rev = CALCULATE ( 
    SUM (Table[Amount] ) ,
    Table[Name] = "Rev"
) 
VAR amount_exp = CALCULATE ( 
    SUM (Table[Amount] ) ,
    Table[Name] = "Exp"
)

RETURN
amount_rev - amount_exp

Hope this helps

 

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


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

Happy to help!

LaDataWeb Blog

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.