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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ccsnet
Frequent Visitor

Matching Totals Once Using Filters

Hi all,

 

I have a series of data which have a shared ID and I would like to show a total only once rather than matching to every line.

The following is the code I have and the result... does any one have a correct or better way of doing this ?

 

 

 

 

Sum Project Not Billed Milestones = 
CALCULATE(
    SUM(AT_ContractMilestones_NotBilled[amount]),
    FILTER(
        AT_ContractMilestones_NotBilled,
        AT_ContractMilestones_NotBilled[contractID] = AT_Projects[contractID]
    )
)

 

 

 

 

Capture.PNG

 

The above should only show ยฃ42.900.00 the first time its matched and no other times so the total at the bottom is correct.

 

There could be other matches through the data and those too should only be shown once.

 

Thanks In Advance

 

Terran

1 ACCEPTED SOLUTION
ccsnet
Frequent Visitor

Thank you all - for now I have gone with ...

 

This is because SUMX did not want to work and repeated the same number all the way down however I will go back but assume I could get a couple of missed numbers for now.

 

 

Sum Project Billed Milestones = 
CALCULATE(
    SUM(Autotask_ContractMilestones_Billed[amount]),
    FILTER(
        DISTINCT(Autotask_ContractMilestones_Billed[contractID]),
        Autotask_ContractMilestones_Billed[contractID] = Autotask_Projects[contractID]
    )
)

 

 

I will also have a look at the schema option which seems to be a good way forward too.

 

Thanks

 

T

View solution in original post

4 REPLIES 4
some_bih
Super User
Super User

Hi @ccsnet usually, the best practice using Star schema is to show ID's based on some dimensions, like product id, or Customer ID.

Choose your Customer ID from your dimension table and check results. Check link for example





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






123abc
Community Champion
Community Champion

To achieve the desired result of showing the total only once for each unique match, you can use the DISTINCT function in DAX. This function ensures that only distinct values are considered in the calculation. Here's how you can modify your DAX measure:

 

Sum Project Not Billed Milestones =
CALCULATE(
SUMX(
DISTINCT(AT_Projects[contractID]),
CALCULATE(
SUM(AT_ContractMilestones_NotBilled[amount]),
FILTER(
AT_ContractMilestones_NotBilled,
AT_ContractMilestones_NotBilled[contractID] = AT_Projects[contractID]
)
)
)
)

 

In this measure:

  • SUMX iterates over each distinct contractID in the AT_Projects table.
  • DISTINCT function ensures that each contractID is considered only once.
  • CALCULATE is used to perform the filtering and calculation for each distinct contractID.
  • FILTER is applied to filter the AT_ContractMilestones_NotBilled table based on the current contractID being iterated.
  • SUM calculates the sum of the filtered amount for each contractID.

This way, the total should only be shown once for each unique match, ensuring the correctness of the total at the bottom.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Anonymous
Not applicable

Hi @ccsnet ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1707201986244.png

vtangjiemsft_1-1707201997022.png

(2) We can create a measure. 

Sum Project Not Billed Milestones = 
CALCULATE(
    SUM(AT_ContractMilestones_NotBilled[amount]),
    FILTER(
        AT_ContractMilestones_NotBilled,
        AT_ContractMilestones_NotBilled[contractID] =MAX(AT_Projects[contractID])
    )
)

(3) Then the result is as follows.

vtangjiemsft_2-1707202054779.png

 

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.

 

Best Regards,

Neeko Tang

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

ccsnet
Frequent Visitor

Thank you all - for now I have gone with ...

 

This is because SUMX did not want to work and repeated the same number all the way down however I will go back but assume I could get a couple of missed numbers for now.

 

 

Sum Project Billed Milestones = 
CALCULATE(
    SUM(Autotask_ContractMilestones_Billed[amount]),
    FILTER(
        DISTINCT(Autotask_ContractMilestones_Billed[contractID]),
        Autotask_ContractMilestones_Billed[contractID] = Autotask_Projects[contractID]
    )
)

 

 

I will also have a look at the schema option which seems to be a good way forward too.

 

Thanks

 

T

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)