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,
It works! Thanks for the solution.