Forum Discussion
How to set a default value
I've created a Power BI report to track the completion rate of online training modules per Business Unit. This report includes two charts:
- Chart 1: Completion rate per module
- This chart allows filtering data by training module.
- Chart 2: Completion rate per Business Unit
- This chart displays the completion rate per Business Unit, based on the modules selected in Chart 1.
- Problem:
- When no module is selected in Chart 1, Chart 2 displays an incorrect completion rate.
I want Chart 2 to display the overall average completion rate for all training modules when no module is selected in Chart 1.
OliviaM Hi!
Instead of directly using the completion rate column, create a measure that dynamically adjusts based on the selection, like:
Completion Rate Display =
VAR SelectedModules = SELECTEDVALUE(TrainingModules[ModuleName], "ALL")RETURN
IF(
SelectedModules = "ALL",
AVERAGEX(ALL(TrainingModules), [CompletionRate]), -- Calculate overall average when nothing is selected
AVERAGE([CompletionRate]) -- Otherwise, calculate based on selection
)BBF
Hi OliviaM,
Thank you for reaching out to the Microsoft Fabric Forum Community.I’ve reproduced your scenario using sample data matching your raw data structure and achieved the expected output. Added the following DAX measures to the table.
Completion Rate BU = VAR SelectedModules = ISFILTERED( 'table'[Module Name] ) RETURN IF( SelectedModules, AVERAGE( 'table'[Completion Rate] ), CALCULATE( AVERAGE( 'table'[Completion Rate] ), ALL( 'table'[Module Name] ) ))The .pbix file attached demonstrates this working solution with your sample data.
If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.- Anonymous1 year ago
Hi OliviaM ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
4 Replies
- BeaBFSuper User
OliviaM Hi!
Instead of directly using the completion rate column, create a measure that dynamically adjusts based on the selection, like:
Completion Rate Display =
VAR SelectedModules = SELECTEDVALUE(TrainingModules[ModuleName], "ALL")RETURN
IF(
SelectedModules = "ALL",
AVERAGEX(ALL(TrainingModules), [CompletionRate]), -- Calculate overall average when nothing is selected
AVERAGE([CompletionRate]) -- Otherwise, calculate based on selection
)BBF
- v-ssriganeshCommunity Support
Hi OliviaM,
Thank you for reaching out to the Microsoft Fabric Forum Community.I’ve reproduced your scenario using sample data matching your raw data structure and achieved the expected output. Added the following DAX measures to the table.
Completion Rate BU = VAR SelectedModules = ISFILTERED( 'table'[Module Name] ) RETURN IF( SelectedModules, AVERAGE( 'table'[Completion Rate] ), CALCULATE( AVERAGE( 'table'[Completion Rate] ), ALL( 'table'[Module Name] ) ))The .pbix file attached demonstrates this working solution with your sample data.
If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you. - OliviaMNew Member
Thank you all for your answers! It's really helpful. I will keep you posted : )
- AnonymousNot applicable
Hi OliviaM ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.