March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi everyone,
could anyone help me with the formula?
I have two fact tables NetSales and Lead Table.
NetSales Table has Customer ID, Date, Material#, Volume columns
Lead Table has Customer ID, Lead Start Date (different customers could have different lead start date with same campaign ID), Campaign ID.
And I want to calculate the volume for Material A for customers 12 months before the leads start date.
I have formula below and it doesn't work.
Thanks,
Shayla
Solved! Go to Solution.
Hi @shayla,
As per your description, I have created two tables and created relationships for them.
Create MEASURE.
Volume Before Lead Start =
CALCULATE(
SUM(NetSales[Volume]),
FILTER(
'NetSales'.
NetSales[Material#] = "A" &&
NetSales[Customer ID] IN VALUES('Lead'[Customer ID]) &&
DATEDIFF(NetSales[Date], RELATED('Lead'[Lead Start Date]), MONTH) <= 12 &&
DATEDIFF(NetSales[Date], RELATED('Lead'[Lead Start Date]), MONTH) > 0
)
)
If the results obtained are not what you expected. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @shayla,
As per your description, I have created two tables and created relationships for them.
Create MEASURE.
Volume Before Lead Start =
CALCULATE(
SUM(NetSales[Volume]),
FILTER(
'NetSales'.
NetSales[Material#] = "A" &&
NetSales[Customer ID] IN VALUES('Lead'[Customer ID]) &&
DATEDIFF(NetSales[Date], RELATED('Lead'[Lead Start Date]), MONTH) <= 12 &&
DATEDIFF(NetSales[Date], RELATED('Lead'[Lead Start Date]), MONTH) > 0
)
)
If the results obtained are not what you expected. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
132 | |
90 | |
88 | |
64 | |
58 |
User | Count |
---|---|
203 | |
141 | |
107 | |
73 | |
70 |