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
chonchar
Helper V
Helper V

Count occurrences of domains - specific user

@parry2k @Erokor 

 

Good morning, All,

 

I have a table as seen below called "Fiscal 23." In that table I have multiple columns. Two of which are "Screened By" and "Domain."

chonchar_0-1697631541937.png

I currently have a count of ALL domains totals as a measure. 

 

What I need now is a measure that caclulates the Domain totals less 1 specified user in the Screened By Column. 

 

I will use myself as the example. Notice I have 3 occurrences of my domain in the above table. 

 

I would like the measure to output this:

 

chonchar_1-1697631754413.png

Notice that there are only four occurrences of domains (minus the three that are tied to the user name "chonchar."

 

Thank you,

 

Cam

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @chonchar ,

Please try to create a measure with below dax formula:

Measure =
VAR cur_domain =
    SELECTEDVALUE ( 'Table'[Domain] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Screened By] <> "CHONCHAR" )
VAR tmp1 =
    CALCULATETABLE (
        VALUES ( 'Table'[Screened By] ),
        FILTER ( tmp, [Domain] = cur_domain )
    )
VAR _result =
    COUNTROWS ( tmp1 )
RETURN
    _result

Add a table visual with field and measure:

vbinbinyumsft_0-1697770185507.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-binbinyu-msft
Community Support
Community Support

Hi @chonchar ,

Please try to create a measure with below dax formula:

Measure =
VAR cur_domain =
    SELECTEDVALUE ( 'Table'[Domain] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Screened By] <> "CHONCHAR" )
VAR tmp1 =
    CALCULATETABLE (
        VALUES ( 'Table'[Screened By] ),
        FILTER ( tmp, [Domain] = cur_domain )
    )
VAR _result =
    COUNTROWS ( tmp1 )
RETURN
    _result

Add a table visual with field and measure:

vbinbinyumsft_0-1697770185507.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-binbinyu-msft 

 

Great Solution. Thank you very much. 

 

That measure (which works) only counts the distinct occurrences of the domains. 

 

How would I count the occurrences of each of those domains in my data model and not just the distinct users?

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.