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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
nckpedersen
Helper I
Helper I

If SelectedValue has a positive value in both columns within matrix

Need some help on grid calculations. Given the matrix below, how can I retrieve values that have a positive count in both 2022 and 2023 (Crowdstrike both DEN and DGN = 1, Crowe DGN = 1, ICA = 0, Data Storage DGN = 0):

nckpedersen_0-1690312956179.png

Sample data below. 

IdNameGroupDate
abc123Data Storage CorporationDGN2022
abc124Dajani Consulting Inc.ICA2023
abc125Dajani Consulting Inc.ICA2022
abc126Datadog IncICA2023
abc127Crowe LLPICA2022
abc128CrowdStrike IncDEN2022
abc129CrowdStrike IncDEN2023
abc130Crown Castle International Corp.DEN2023
abc131Crown Castle International Corp.DEN2022
abc132Crown Castle International Corp.DGN2023
abc133Crown Castle International Corp.DGN2022
abc134Datadog IncDGN2022
abc135Data.WorldDGN2022
abc136CrowdStrike IncDGN2022
abc137CrowdStrike IncDGN2023
abc138Crowe LLPDGN2023
abc139Crowe LLPDGN2022

 

1 ACCEPTED SOLUTION
nckpedersen
Helper I
Helper I

Found the answer using variables:

21/22 YoY =
    var count_2021 = calculate(count('Purchases'[Id]),year('Purchases'[CloseDate])=2021)
    var count_2022 = calculate(count('Purchases'[Id]),year('Purchases'[CloseDate])=2022)
return
    if(count_2021 > 0 && count_2022 > 0, 1, 0)

View solution in original post

1 REPLY 1
nckpedersen
Helper I
Helper I

Found the answer using variables:

21/22 YoY =
    var count_2021 = calculate(count('Purchases'[Id]),year('Purchases'[CloseDate])=2021)
    var count_2022 = calculate(count('Purchases'[Id]),year('Purchases'[CloseDate])=2022)
return
    if(count_2021 > 0 && count_2022 > 0, 1, 0)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors