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

Divide count distinct column by non calculated column

Hi,

 

I'm doing a quick measure to divide 2 columns without doing any calculation on the denominator column.

 

So here's the scenario: The numerator column(lesson count) does a count of lessons and i have a criteria for each school. I entered the criteria(required lesson) by creating a table in powerbi and joining by school in the relationships tab. The issue is that when i try to divide lesson count(i did a count distinct on this column which is what i wanted) by required lesson, it forces me want to use some form of aggregation(sum, count, standard deviation, etc) to the required lesson column which is not want i want. I just want to divide lesson count/required lesson without the aggregation to the denominator. Is there a dax that does this perfectly? I've looked at some post but the answers i see is not working for me.

 

Please help.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@oriabbhou1 try the following 

% Completion = DIVIDE('Lessons(SQL Table)'[Count of Lesson],RELATED('Lesson Required Table'[Lesson Required]))

Karlos_0-1611499017412.png

Karlos_1-1611499026080.png

 

I've added a PBIX file to this one drive link that shows how I achieved it for you. 

https://1drv.ms/u/s!AnIEh6WhI4Jog4ginCxsERXWt36plg?e=DX9UAm 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@oriabbhou1 try the following 

% Completion = DIVIDE('Lessons(SQL Table)'[Count of Lesson],RELATED('Lesson Required Table'[Lesson Required]))

Karlos_0-1611499017412.png

Karlos_1-1611499026080.png

 

I've added a PBIX file to this one drive link that shows how I achieved it for you. 

https://1drv.ms/u/s!AnIEh6WhI4Jog4ginCxsERXWt36plg?e=DX9UAm 

This worked Perfect. Thanks soo much @Anonymous 

Anonymous
Not applicable

Hey @oriabbhou1 , 

Can you share a sample of the data you're working with and your desired results, please?

 

Karlos. 

iXpert_info
Helper II
Helper II

Hey @oriabbhou1 

I'd Suggest you to create a Calculated column for your solution

column=divide(table[LessonCount],table[RequiredLesson],0)

if you dont want to use above solution can you please share some sample data

Did I answer your question? If Yes, Please mark this as a solution

Best Regards
Jay Patel
iXpert Analytics

Hi @iXpert_info & @Anonymous ,

 

I tried creating a calulated column but the required lessons column from the lessons required table is not popping up as the denominator. 

Both columns are whole numbers so i dont see why it shouldnt work. I'm pretty much trying to accomplish the % completion colum in the sample data below.

 

Here's my sample data below:

 

nets question.PNG

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.

Top Solution Authors