Forum Discussion
Quick measure functionality in report
- 1 year ago
Hi Poojara,
It works! Thanks for the solution.
Hi Riksall
To dynamically calculate the correlation between two user-selected measures in Power BI, you need a workaround because the SELECTEDMEASURE() function cannot be used more than once within a single calculation group item. A practical solution involves creating two separate disconnected parameter tables that list all the available measures (e.g., "Sales", "Profit", etc.) and allow users to select one measure from each table. You then create two corresponding DAX measures using the SWITCH() function that return the values for the selected measure names from each parameter table. These two dynamic measures can then be used in a third DAX measure to compute the correlation coefficient using the standard Pearson correlation formula. This formula calculates the average of both selected measures, computes the covariance between them, and divides it by the product of their standard deviations. While this method requires maintaining the SWITCH logic manually and may not be as elegant as using calculation groups, it offers a flexible and user-friendly way to perform dynamic correlation analysis without duplicating logic for each measure combination. This approach works well in most reporting scenarios and empowers users to explore different relationships in the data interactively.
Hi Poojara, thanks for your idea/solution. I will test your setup shortly and come back to you with the result the coming few days.
- Anonymous1 year agoNot applicable
Hi Riksall,
Hope everything’s going smoothly on your end. We haven’t heard back from you, so I wanted to check if got the chance to test the setup provided by Poojara_D12.
Or the issue is still there? No worries just drop us a message and we can jump back in on the issue.Best Regards,
Hammad.