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
Anonymous
Not applicable

Updating measure

Hi

 

Please I need suggestions on how to solve this issue. ,

 

I have a table A, which has  4 columns, Locations, Trials and Interventions.  The task is to count the trials and interventions which have a United Kingdom  location. 

 

Capture.JPG

 

 Currently I have a manual workaround which relies on a filter.  And I use two cards to display the count of Trials and Interventions respectively. However this means that I have to regularly check the filter to ensure that all values with United Kingdom is selected -- see below.  Capture2.JPG

 

 

Please any suggestions on the DAX formula to  count of the number of Trials and Intervention where the

location column has a United Kingdom entry and display this value on a measure.

 

Thank you

PhyllisN

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Just try the following two measure:

 

 

 

CountTrail = CALCULATE(DISTINCTCOUNT('Table'[Trials]),ALL('Table'),IFERROR(SEARCH("United Kingdom",'Table'[Locations]),-1) > 0)
CountInterventions = CALCULATE(DISTINCTCOUNT('Table'[Interventions]),ALL('Table'),IFERROR(SEARCH("United Kingdom",'Table'[Locations]),-1) > 0)

 

 

 

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

10 REPLIES 10
pranit828
Community Champion
Community Champion

HI @Anonymous 

 

I don't understand why you need two different cards.

Is the data different on both of them. If not use the same measure for both cards.

 

Looks like there is something missing from the ask. What is the 4th column?

 

Regards,

Pranit





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
Anonymous
Not applicable

Hi @pranit828 

 

Yes the data is different for both trials and intervention.

 

Thanks

Hi @Anonymous ,

 

Just try the following two measure:

 

 

 

CountTrail = CALCULATE(DISTINCTCOUNT('Table'[Trials]),ALL('Table'),IFERROR(SEARCH("United Kingdom",'Table'[Locations]),-1) > 0)
CountInterventions = CALCULATE(DISTINCTCOUNT('Table'[Interventions]),ALL('Table'),IFERROR(SEARCH("United Kingdom",'Table'[Locations]),-1) > 0)

 

 

 

 

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

 

Best Regards,

Dedmon Dai

Anonymous
Not applicable

Hi Dai

 

Thank you for your response. For some reason, I got an error message please see screen shots below.  What did I do wrong?

Capture6.JPGCapture5.JPG

 

Thanks in advance 

 

 

Hi @Anonymous ,

 

I have edited my original reply. Please try again.

 

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

 

Best Regards,

Dedmon Dai

 

Anonymous
Not applicable

Hi @pranit828 

 

There is a typo in the sentence. It should be 3 columns.  The client wants to display the counts on two separate cards.

 

Thanks

Hi @Anonymous 

 

If the ask is display the same count on two seperate cards. Still I don't get why so? I'm puzzled.

 

However, use the below formula and create two cards and use the same measure in both of them.

_Count = CALCULATE(COUNTROWS('Table'),SEARCH("United Kingdom",'Table'[Locations]) > 0)

 

Did I resolve your issue? Mark my post as a solution!

 

Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
FrankAT
Community Champion
Community Champion

Hi @Anonymous 

this is a measure for a card:

 

Count trials and interventions = 
CALCULATE(
    COUNTROWS('Table'),
    LEFT('Table'[Locations],14) = "United Kingdom"
)

15-08-_2020_22-58-23.png

 Regards FrankAT

Anonymous
Not applicable

Hi @FrankAT 

 

Thank you for your response. However the counts for trials and interventions need to be displayed on two separate cards. 

 

On a different note, please explain why you have 14 in the formula.

 

Thank you

 

 

Hi,

Based on the data that you have shared, show the exact result you are expecting.  Also, in the image Column A is not wide enough so i cannot see that else is there in ech cell.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.