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
datapal04
Frequent Visitor

Summing the Count of 2 Columns

Hello,

I am trying to create a measure that sums the count of 2 columns even though one of the columns is used as a primary key in a relationship to a fact table. Let me explain through an example.

I have the dimension table below:

Primary Complaint CodeSecondary Complaint CodeMetric
General Announcements  (Safety, Etiquette, & non-Status)Customer BehaviourEnforcement of Quiet Zone on upper level of train coaches
Service Change Communication – ContentService Change Communication – Timeliness/FrequencyKeeping me informed of upcoming schedule changes
General Announcements  (Safety, Etiquette, & non-Status)Service Status Communication – Timeliness/FrequencyFrequency of announcements on board the train 

The Primary Complaint Code column is used as a key to relate to the fact table below (Complaint Code😞

Case_NumberComplaint Code
301-553535-N9D9V7Service Status Communication – Timeliness/Frequency
301-553613-H6Y2R5Customer Behaviour
301-553632-V7R4D1Customer Behaviour
301-553700-B6R1S4Service Change Communication – Content
301-553724-G1R7G6Service Change Communication – Timeliness/Frequency
301-553737-H8C8G9General Announcements  (Safety, Etiquette, & non-Status)
301-553860-R3C0Y2Customer Behaviour
301-553967-R9C2N1Service Change Communication – Content
301-553999-Y7R8G2Service Change Communication – Content
301-554008-X3C1N4Customer Behaviour
301-554020-J4G4D2Customer Behaviour
301-554101-F2Y1T3General Announcements  (Safety, Etiquette, & non-Status)
301-554214-V2H5W1Service Status Communication – Timeliness/Frequency
301-554399-J4V0V3General Announcements  (Safety, Etiquette, & non-Status)

The measure I need to create will need to sum the discount count of case numbers for both Primary and Secondary complaint codes for every Metric. The expected result is below:

MetricCount
Enforcement of Quiet Zone on upper level of train coaches8
Keeping me informed of upcoming schedule changes4
Frequency of announcements on board the train 5

Thanks in advance for your help!

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@datapal04 

pls try this

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Complaint Code]=max('Dimension'[Primary Complaint Code])))+CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Complaint Code]=max('Dimension'[Secondary Complaint Code])))

1.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
ryan_mayu
Super User
Super User

@datapal04 

pls try this

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Complaint Code]=max('Dimension'[Primary Complaint Code])))+CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Complaint Code]=max('Dimension'[Secondary Complaint Code])))

1.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.