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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
vengadesh_p
Helper I
Helper I

Need Help on Dax to achieve this logic

Hi All,

 

I have data like below table 

YearNameIs Active
2018ABCNO
2018ABCYES
2020ABCYES
2021ABCYES
2022ABCNO

 

i want to show this information in pivot table

if person has two different status in same year we want to consider Yes condition & if we dont have record for any year we want to consider as NO Status

Expected Result 

vengadesh_p_0-1649741851075.png

Ex: 2018 we have two status (Yes\No) so we want to consider Yes
2019 we dont have any record so we want to consider NO

How Can i Achive this logic in DAX?

Thanks

3 REPLIES 3
vengadesh_p
Helper I
Helper I

Thanks @Jihwan_Kim 
its working if we have only one user, in my data i have more than 2 user, what i want to update in DAX
for 2018 its not show any data

vengadesh_p_0-1649827712317.png

 



Data:  

YearNameIs Active
2018ABCNO
2018ABCYES
2020ABCYES
2021ABCYES
2022ABCNO
2018XXXNO
2018XXXYES
2020XXXYES
2021XXXNO
2022XXXYES

Hi,

Thank you for your message.

May I ask how do you want to see for the two users?

If it is OK with you, please kindly describe how the expected outcome looks like for the changed sample. It helps a lot to fix the measure and create a more accurate measure.

Thank you.


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below.

 

Picture1.png

 

Expected outcome measure: =
IF (
    HASONEVALUE ( Active[Is Active] ) && HASONEVALUE ( 'Year'[Year] ),
    SWITCH (
        TRUE (),
        CALCULATE ( COUNTROWS ( Data ), ALL ( Active ) ) = 0, IF ( SELECTEDVALUE ( Active[Is Active] ) = "NO", 1 ),
        CALCULATE ( COUNTROWS ( Data ), ALL ( Active ) ) = 1, COUNTROWS ( Data ),
        CALCULATE ( COUNTROWS ( Data ), ALL ( Active ) ) = 2, CALCULATE ( COUNTROWS ( Data ), KEEPFILTERS ( Data[Is Active] = "YES" ) )
    )
)

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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