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
fereshtehaghaei
Helper II
Helper II

Tableau's LOD Average into Power BI DAX formula

I have a basic LOD formula in Tableau that I need to re-write it in Power BI.

My Tableau LOD Formula : 

# of Enrollments: { INCLUDE [Course Unique ID]: AVG([Enrollments])}

 

In Power BI I have tried multiple DAX formula and I am not getting the write number of Enrollments 

# of Enrollments = AVERAGEX(
    VALUES ( 'ResponseRate +Courses'[courseUniqueID]),
    CALCULATE ( SUM( ( responseRates[enrollments]) )
))
 
I am very new to Power BI and not sure if am I writting it wrong or is not possible to calcualte it this way. Any help would be appreciated.
 
Thank You
1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @fereshtehaghaei ,

Based on your problems, here are my answers.

For your DAX code I think you can make changes to it. You use the CALCULATE function to modify the context of the calculation. Inside CALCULATE, you can calculate the average of the enrollments column from the responseRates table using AVERAGE(responseRates[enrollments]).
The ALLEXCEPT function removes all filters except for the courseUniqueID column from the ResponseRate +Courses table. This ensures that the calculation is performed at the desired level of granularity.

# of Enrollments = 
CALCULATE(
    AVERAGE(responseRates[enrollments]),
    ALLEXCEPT('ResponseRate +Courses', 'ResponseRate +Courses'[courseUniqueID])
)

This is just my speculation on your code, if you can provide me with specific data or more information, I can answer for you.

How to Get Your Question Answered Quickly 

 

 

Best Regards

Yilong Zhou

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

 

View solution in original post

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @fereshtehaghaei ,

Based on your problems, here are my answers.

For your DAX code I think you can make changes to it. You use the CALCULATE function to modify the context of the calculation. Inside CALCULATE, you can calculate the average of the enrollments column from the responseRates table using AVERAGE(responseRates[enrollments]).
The ALLEXCEPT function removes all filters except for the courseUniqueID column from the ResponseRate +Courses table. This ensures that the calculation is performed at the desired level of granularity.

# of Enrollments = 
CALCULATE(
    AVERAGE(responseRates[enrollments]),
    ALLEXCEPT('ResponseRate +Courses', 'ResponseRate +Courses'[courseUniqueID])
)

This is just my speculation on your code, if you can provide me with specific data or more information, I can answer for you.

How to Get Your Question Answered Quickly 

 

 

Best Regards

Yilong Zhou

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

 

@v-yilong-msft Thank you for the great suggestion, your solution worked!

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.