Forum Discussion
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.
- Anonymous5 years ago
oriabbhou1 try the following
% Completion = DIVIDE('Lessons(SQL Table)'[Count of Lesson],RELATED('Lesson Required Table'[Lesson Required]))I've added a PBIX file to this one drive link that shows how I achieved it for you.
5 Replies
- iXpert_info
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- oriabbhou1Frequent Visitor
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:
- AnonymousNot applicable
Hey oriabbhou1 ,
Can you share a sample of the data you're working with and your desired results, please?Karlos.
- AnonymousNot applicable
oriabbhou1 try the following
% Completion = DIVIDE('Lessons(SQL Table)'[Count of Lesson],RELATED('Lesson Required Table'[Lesson Required]))I've added a PBIX file to this one drive link that shows how I achieved it for you.
- oriabbhou1Frequent Visitor
This worked Perfect. Thanks soo much Anonymous