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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
UK_User123456
Resolver I
Resolver I

Counting the number of Campaign ID's

Hi All,

 

Below is an example of the dataset to which I wanted to be able to return the total number of campaign ID's given in the first instance, then counting the number of campaign ID's that were given in the second instance .

 

Gift DateCampaign IDGift Date 2Campaign ID 2
02/04/2018Camp - 12115/05/2018Camp - 252
12/05/2019Camp - 23216/05/2019Camp - 252
06/05/2019Camp - 12123/05/2019Camp - 252
07/06/2019Camp - 23201/06/2019Camp - 252
08/05/2019Camp - 12112/05/2019Camp - 555
09/06/2018Camp - 12123/06/2018Camp - 252
10/06/2019Camp - 12112/06/2019Camp - 252
11/06/2018Camp - 23215/06/2018Camp - 232
12/06/2019Camp - 12115/06/2018Camp - 232
13/06/2018Camp - 12117/06/2018Camp - 232
Total10  
    
 2526 
 5551 
 2323 

 

I tried doing a count, but keep getting errors. didnt know if there was an alternative way of doing this?

 

TIA

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

Hi @UK_User123456 ,

The following is my sample you can have a try.

 

For table 1 :

  1. Create a measure.
Measure = COUNT(Table1[Campaign ID])

1.png

For table 2:

  1. Create a measure
Measure 2 = 
SWITCH(     TRUE(),     MAX(Table4[Campaign ID 2]) = "Camp - 252",CALCULATE(COUNT(Table4[Campaign ID 2]),ALLEXCEPT(Table4,Table4[Campaign ID 2])),     MAX(Table4[Campaign ID 2]) = "Camp - 232",CALCULATE(COUNT(Table4[Campaign ID 2]),ALLEXCEPT(Table4,Table4[Campaign ID 2])), MAX(Table4[Campaign ID 2]) = "Camp - 555",CALCULATE(COUNT(Table4[Campaign ID 2]),ALLEXCEPT(Table4,Table4[Campaign ID 2])))

2.jpg

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
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

4 REPLIES 4
v-xuding-msft
Community Support
Community Support

Hi @UK_User123456 ,

Could you tell me if your problem has been solved? If it is, kindly mark the helpful answer as a solution if you feel that makes sense. Welcome to share your own solution. More people will benefit from here.

 

Best Regards,

Xue Ding

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

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

Hi,

 

I havent had the chance to test it out yet, I will do as soon as I can and come back with any issues.

Okay, I hope your issue can be solved smoothly. 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-xuding-msft
Community Support
Community Support

Hi @UK_User123456 ,

The following is my sample you can have a try.

 

For table 1 :

  1. Create a measure.
Measure = COUNT(Table1[Campaign ID])

1.png

For table 2:

  1. Create a measure
Measure 2 = 
SWITCH(     TRUE(),     MAX(Table4[Campaign ID 2]) = "Camp - 252",CALCULATE(COUNT(Table4[Campaign ID 2]),ALLEXCEPT(Table4,Table4[Campaign ID 2])),     MAX(Table4[Campaign ID 2]) = "Camp - 232",CALCULATE(COUNT(Table4[Campaign ID 2]),ALLEXCEPT(Table4,Table4[Campaign ID 2])), MAX(Table4[Campaign ID 2]) = "Camp - 555",CALCULATE(COUNT(Table4[Campaign ID 2]),ALLEXCEPT(Table4,Table4[Campaign ID 2])))

2.jpg

Best Regards,

Xue Ding

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

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.