The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello everyone
I'm facing a problem. I need to calculate the aging of each record monthly based on its status. However, there is an ID containing duplicate records on Aug. The majority of the record is the same, the only difference is the supplier's information which I don't need. In this case, is there a way to remove these duplicates without influencing other months' data?
Here is the screenshot. I'm thinking to add a filter to eliminate duplicates.
THanks in advance for helping
Solved! Go to Solution.
Hi , @Anonymous
According to your description, you want to calcuate average of the [Aging] without duplicates in dax.
Here are the steps you can refer to:
(1)This is my test data:
(2)We can create a measure like this:
Measure = var _t= FILTER('Sheet3','Sheet3'[NC Owning Business Type Name]="Trauma and Extremities" && 'Sheet3'[NC Priority] <> 3 && 'Sheet3'[NC Project]="Nonconformance")
var _t2=SUMMARIZE(_t, [NC Pr Id],"aging" , MAX('Sheet3'[Aging]))
return
AVERAGEX(_t2,[aging])
(3)Then we can meet your need , the result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @Anonymous
According to your description, you want to calcuate average of the [Aging] without duplicates in dax.
Here are the steps you can refer to:
(1)This is my test data:
(2)We can create a measure like this:
Measure = var _t= FILTER('Sheet3','Sheet3'[NC Owning Business Type Name]="Trauma and Extremities" && 'Sheet3'[NC Priority] <> 3 && 'Sheet3'[NC Project]="Nonconformance")
var _t2=SUMMARIZE(_t, [NC Pr Id],"aging" , MAX('Sheet3'[Aging]))
return
AVERAGEX(_t2,[aging])
(3)Then we can meet your need , the result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@Anonymous ,
Personally, I think this operation is best done using Power Query.
In Power Query, you can delete your Supplier column that you don't need.
Then use the Remove Rows to remove your duplicates
Hope you can make this work for you.
Regards,
Hi, @rsbin Thanks for replying to me.
In this case, if I use the Remove duplicate button, it will remove other months' data that I really need.
@Anonymous Maybe:
Measure =
VAR __Table =
SELECTCOLUMNS(
FILTER(
'NC Aging',
'NC Aging'[NC Owning Business Type Name] = "Trauma and Extremities" &&
'NC Aging'[NC Priority] <> "3" &&
'NC Aging'[NC Project] = "Nonconformance" &&
([Year] <> 2022 && [Month] <> "August")
),
"__Aging",[Aging]
)
VAR __TableAugust =
DISTINCT(
SELECTCOLUMNS(
FILTER(
'NC Aging',
'NC Aging'[NC Owning Business Type Name] = "Trauma and Extremities" &&
'NC Aging'[NC Priority] <> "3" &&
'NC Aging'[NC Project] = "Nonconformance" &&
([Year] = 2022 && [Month] = "August")
),
"__NCPrId",[NC Pr Id],
"__Aging",[Aging]
)
)
VAR __FinalTable = UNION(__Table,SELECTCOLUMNS(__TableAugust,"__Aging",[__Aging]))
RETURN
AVERAGEX(__FinalTable,[__Aging])