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
Oscar_Mtz_V
Kudo Commander
Kudo Commander

Counting the number of occurences from the full table and show this number per row

Hi Everyone,

 

I would really appreciate anyone helps me with the following; I have the table bellow and I need to calculate the column in yellow.

Annotation 2020-01-22 140329.jpg

The column nees to evaluate, per row, how many rows of the same id are "null" (or any other condition).

 

For ID 1, every row shows 3 as three times the colour is blank.

For ID 2, every row shows 0 as the colour is never blank.

For ID 3, the only row shows 1 as one time the colour is blank.

 

In advance thanks for your support.

 

Oscar

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @Oscar_Mtz_V

The dax code needed to do this is as follows:

Calculation =
VAR Currentvalue = 'Table'[ID]
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' );
        'Table'[ID] = Currentvalue;
        'Table'[Color] = BLANK ()
    ) + 0

 It wil calculated per row the amount of rows in the table that have the same ID and where the color value is blank.

 

Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily. 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hello @Oscar_Mtz_V

The dax code needed to do this is as follows:

Calculation =
VAR Currentvalue = 'Table'[ID]
RETURN
    CALCULATE (
        COUNTROWS ( 'Table' );
        'Table'[ID] = Currentvalue;
        'Table'[Color] = BLANK ()
    ) + 0

 It wil calculated per row the amount of rows in the table that have the same ID and where the color value is blank.

 

Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily. 

@Anonymous you rock!!! Exactly what I needed, thanks!!

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.