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
abeirne
Helper II
Helper II

If columns contains "CASH", do this

Hi all, I am trying to do a calculation where if the category = "CASH", subtract paid out amount from MOP amount. Else, just show MOP amount. 

Amount =
IF(
SELECTEDVALUE(Daily_MOP_Tb[MOP COMB]) = "CASH",
SUM(Daily_MOP_Tb[MOP_Amount]) - SUM(Paid_Out_Tb[Paid_Out_Amount]),
SUM(Daily_MOP_Tb[MOP_Amount])
)
I am not sure what to use to determine the category. Selectedvalue and values does not work. Thank you all!
1 ACCEPTED SOLUTION
vapid128
Solution Specialist
Solution Specialist

IF(
MAX(Daily_MOP_Tb[MOP COMB]) = "CASH" && MIN(Daily_MOP_Tb[MOP COMB]) = "CASH",
SUM(Daily_MOP_Tb[MOP_Amount]) - SUM(Paid_Out_Tb[Paid_Out_Amount]),
SUM(Daily_MOP_Tb[MOP_Amount])
)

View solution in original post

3 REPLIES 3
vapid128
Solution Specialist
Solution Specialist

IF(
MAX(Daily_MOP_Tb[MOP COMB]) = "CASH" && MIN(Daily_MOP_Tb[MOP COMB]) = "CASH",
SUM(Daily_MOP_Tb[MOP_Amount]) - SUM(Paid_Out_Tb[Paid_Out_Amount]),
SUM(Daily_MOP_Tb[MOP_Amount])
)
music43
Advocate II
Advocate II

Have you tried creating a measure such as Test = selectedvalue(Daily_MOP_Tb[MOP COMB]) and dropping it in a table/matrix to see what it returns?
Also, it might be worth checking for spaces to make sure "CASH" isn't something like "CASH      " in your data...?

SpartaBI
Community Champion
Community Champion

@abeirne is this a measure or a calculated column?
If column then write this:

 

IF(
Daily_MOP_Tb[MOP COMB] = "CASH",
Daily_MOP_Tb[MOP_Amount] - Paid_Out_Tb[Paid_Out_Amount],
Daily_MOP_Tb[MOP_Amount]
)

 

 


2022-05-09 22_36_04-Power BI Workspace Datasets License Permissions - Microsoft Power BI Community.png

Showcase Report – Contoso By SpartaBI


SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Full-Logo11.png

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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