The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I have a 'Opportunity Field History' table. Every row contains a stage change for an opportunity. I need to count opportunities Id's where within the 'New Value' been both "4 - Estimate Generated" and "6 - Closed Won". Because they're not in both stages at the same time, I cannot get my filters to work correctly in my summarize formula. If I use || it counts opportunities that have been in eith stage but not both and && draws and gets zero because they cant be in the stage at the same time. I need to calculate this for both 2023 and 2024.
COUNTROWS(
SUMMARIZE(
FILTER(
'Opportunity Field History',
'Opportunity Field History'[NewValue] = "4 - Estimate Generated" ||
'Opportunity Field history'[NewValue] = "6 - Closed Won"),
'Opportunity Field History'[OpportunityId],
'Opportunity Field History'[NewValue],
'Opportunity Field History'[Created_YR])
)
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but please try something like below whether it produces the expected result.
expected result measure: =
VAR _t01 =
SUMMARIZE (
FILTER (
'Opportunity Field History',
'Opportunity Field History'[NewValue] = "4 - Estimate Generated"
&& 'Opportunity Field History'[Created_YR] IN { 2023, 2024 }
),
'Opportunity Field History'[OpportunityId]
)
VAR _t02 =
SUMMARIZE (
FILTER (
'Opportunity Field History',
'Opportunity Field History'[NewValue] = "6 - Closed Won"
&& 'Opportunity Field History'[Created_YR] IN { 2023, 2024 }
),
'Opportunity Field History'[OpportunityId]
)
VAR _intersectlist =
INTERSECT ( _t01, _t02 )
RETURN
COUNTROWS ( _intersectlist )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
I am not sure if I understood your question correctly, but please try something like below whether it produces the expected result.
expected result measure: =
VAR _t01 =
SUMMARIZE (
FILTER (
'Opportunity Field History',
'Opportunity Field History'[NewValue] = "4 - Estimate Generated"
&& 'Opportunity Field History'[Created_YR] IN { 2023, 2024 }
),
'Opportunity Field History'[OpportunityId]
)
VAR _t02 =
SUMMARIZE (
FILTER (
'Opportunity Field History',
'Opportunity Field History'[NewValue] = "6 - Closed Won"
&& 'Opportunity Field History'[Created_YR] IN { 2023, 2024 }
),
'Opportunity Field History'[OpportunityId]
)
VAR _intersectlist =
INTERSECT ( _t01, _t02 )
RETURN
COUNTROWS ( _intersectlist )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thank you Jihwan_Kim. This worked. I did try a similar version using UNION and count. It wasnt working correctly though. I'll dig into it later. This is the first time I've used INTERSECT.
Thanks again
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
79 | |
76 | |
46 | |
39 |
User | Count |
---|---|
143 | |
115 | |
64 | |
64 | |
53 |