Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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]
)
)
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
Solved! Go to Solution.
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
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
Hi @ccsnet ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(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.
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.
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:
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.
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
Proud to be a Super User!
User | Count |
---|---|
57 | |
22 | |
18 | |
16 | |
11 |
User | Count |
---|---|
85 | |
54 | |
39 | |
21 | |
18 |