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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.