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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
RonaldF
New Member

Dax

I have an Access database that I have imported into Power BI. I have an "Event" table with fields [EventID], [Year], [Style], [Distance], etc. It is joined to a "Results" table with fields [EventID], [Name], etc.
I have four DAX measures to count participations for each [Name] in four categories: (Long FR, Long CL, Middle FR, Middle FR):
Long CL Participations = CALCULATE(COUNTROWS(Results),Event[Style]="CL",Event[Distance]="Long")
Long FR Participations = CALCULATE(COUNTROWS(Results),Event[Style]="FR",Event[Distance]="Long")
Middle CL Participations = CALCULATE(COUNTROWS(Results),Event[Style]="CL",Event[Distance]="Middle")
Middle FR Participations = CALCULATE(COUNTROWS(Results),Event[Style]="FR",Event[Distance]="Middle")
and then I use:
Total Participations = COUNTROWS(Results)
to get a Total Participations for each [Name].
However I need a DAX measure to count for each [Name] how many Long CL and Long FR events in the same Year they have done. Can you suggest a solution?

1 ACCEPTED SOLUTION

Problem solved,

I found a solution. I created two queries and then merged them on on only the matching fields.

Thanks, RonaldF

View solution in original post

5 REPLIES 5
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@RonaldF,

Could you please share sample data of the two tables(Event and Results) and post expected result in table?

We also need to know what specific fields you use to create relationship between Event and Results.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Problem solved,

I found a solution. I created two queries and then merged them on on only the matching fields.

Thanks, RonaldF

Ashish_Mathur
Super User
Super User

Hi,

 

I suggest that you create slicers from the Event table for Style and Distance.  Simplify your formula to:

 

=COUNTROWS(Results)

As long as your datasets have a proper relationship, you should now be able to slice your visual by any attribute.

 

 


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

Hello Ashish,

Thanks for your suggestion. I have tried slicers, but what I was trying to do was add a column into my table.

In Access I made two queries: (Count Long FR) and (Count Long CL) and then joined them where [Year] = [Year]

Thanks,

RonaldF

Hi,

 

I am sorry but i cannot appreicate why you need a calculated column when a calculated field (measure) and slicer can solve your problem.  May be i am not understanding your question.


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

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.