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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Employee
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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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