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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors