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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
niteshtrehan89
Helper III
Helper III

Urgent : Dax

Hi All,

I need an urgent help from the community members.

 

Customer NumberAcc NumberDor FlagInactive FlagFree Flag
001123Y  
001234 Y 
001345  Y

 

I need to write a dax function where I need to check the contion where either the dormany flag, Inactive flag or FRee flag is Y then we need to take the count of customer based on the customer number.

 

Here I am getting 3 as the result but it needs to be considered as 1 as the customer number is same.

 

This is the Dax i have written.

 

DAX= countrows(filter(table,dormancyflay="Y" || InactiveFlag="Y" || Free Flag="Y") 

 

I need the distinct count of customer  number.

 

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @niteshtrehan89 

You can try the following methods:

Column =
CALCULATE (
    COUNTROWS (
        FILTER (
            'Table',
            'Table'[DorFlag] = "Y"
                || 'Table'[lnactiveFlag] = "Y"
                || 'Table'[FreeFlag] = "Y"
        )
    )
)

vzhangti_0-1634710021551.png

Best Regards,

Charlotte Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Fowmy
Super User
Super User

@niteshtrehan89 

Try the following meaure:

NewMeasure=
CALCULATE (
    DISTINCTCOUNT ( Table[Cust] ),
    FILTER (
        table,
        Table[dormancyflay] = "Y"
            || Table[InactiveFlag] = "Y"
            || Table[Free Flag] = "Y"
    )
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy ,

 

It is not working as expected. 

@niteshtrehan89 

Not sure how your data is organized and the model. Please share a sample PBIX file with dummy data

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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