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
shelbsassy
Resolver I
Resolver I

How to get total cost savings by distinct drug name and member ID with an if statement

I have an IF statement that I thought was working fine until I just realized it is calculating the same drug cost savings for every instance so the numbers are inflated.

 

We have drugs that we switch to lower cost drugs and I have a column with the Monthly Cost Savings if they accept the switch.

Some members hhave more than one intervention where we have reached out to them multiple times.  If they accept the recommendation, the If statement is:

 

Monthly Cost Savings = IF(Sheet1[status_id]=1 || Sheet1[Status_id = 4,Sheet1[Monthly Cost Savings Table],0)

 

I need to somehow differentiate to only add the cost savings once per distinct drug per member.

 

Does anyone have any idea how to do this?  I tried to just add a filter to the end of the statement but it errored out.

 

Thanks for any help!

2 ACCEPTED SOLUTIONS
v-ljerr-msft
Employee
Employee

Hi @shelbsassy,

 

If I understand you correctly, you should be able to use the formula below to create a new measure to calculate the total cost savings by distinct drug name and member ID, then show the measure on the Card visual in your scenario. Smiley Happy

Measure =
SUMX (
    SUMMARIZE (
        Sheet1,
        Sheet1[drug name],
        Sheet1[member ID],
        "Costs", MAX ( Sheet1[Monthly Cost Savings] )
    ),
    [Costs]
)

 

Regards

View solution in original post


@v-ljerr-msft wrote:

Hi @shelbsassy,

 

If I understand you correctly, you should be able to use the formula below to create a new measure to calculate the total cost savings by distinct drug name and member ID, then show the measure on the Card visual in your scenario. Smiley Happy

Measure =
SUMX (
    SUMMARIZE (
        Sheet1,
        Sheet1[drug name],
        Sheet1[member ID],
        "Costs", MAX ( Sheet1[Monthly Cost Savings] )
    ),
    [Costs]
)

 

Regards


Hi @v-ljerr-msft,

 

For my own reference, the following measure will work per distinct drug and member? 

  • Which means one card with the following measure per drug or member, right

 

Thanks

View solution in original post

14 REPLIES 14

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.