Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
When adding a quick measure you can choose your parameters. For instance for the correlation coefficient you can supply your 2 measures. I want that same functionality in my report, because i have 10 measures and for each possible combination i want the correlation to be calculated. So i don't want 10! separate quick measures, but a input box in my report for measure 1 and for measure 2. I looked at a combination of calculation groups and parameter fields. But i can't seem to put 2 different SELECTEDMEASURE() in one calculation item.
So is there a general approach for this? Thanks!
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.
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.
Hi @Riksall,
Thanks for reaching out to the Microsoft fabric community forum.
It looks like you want to dynamically calculate the correlation coefficient between two selectable measures out of a total of 10 available measures but in Power BI, when using Quick Measures, you can supply two measures as input for correlation, but that method creates a fixed measure each time which you does not wants as it creates separate quick measures for every possible pair of the 10 measures.
While you're right that calculation groups don’t support multiple SELECTEDMEASURE() calls in a single item, there's a solid workaround suggested by @wardy912 of using field parameters that gives you the flexibility you're looking for. Kindly go through the response given by @wardy912 and check if your issue can be resolved.
I would also take a moment to thank @wardy912 and @lbendlin, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Best Regards,
Hammad.
Community Support Team
Hi @Riksall,
As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help.
If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.
If so, it would be really helpful for the community if you could mark the answer that helped you the most. If you're still looking for guidance, feel free to give us an update, we’re here for you.
Best Regards,
Hammad.
Hi @Riksall,
I just wanted to follow up on your thread. If the issue is resolved, it would be great if you could mark the helpful reply as solution so other community members facing similar issues can benefit too. If not, don’t hesitate to reach out, we’re happy to keep working with you on this.
Best Regards,
Hammad.
@Riksall you may be able to achieve this with parameter fields. I see from your post you already know how to implement these but i'll add details for others that may need this information.
Create a field parameter that includes all 10 of your measures:
Go to Modeling > New Parameter > Fields.
Add your 10 measures.
This creates a slicer-friendly table with a [Name] and [Fields] column.
You’ll need 2 copies of this parameter table (e.g., MeasureSelector1 and MeasureSelector2) to allow two independent selections from 2 separate slicers . SELECTEDVALUE() assumes only one measure is selected per slicer, so you will want to restrict slicers to single selection.
You will then need a DAX measure that compares the 2 slicer selections
Correlation =
VAR Measure1 = SELECTEDVALUE(MeasureSelector1[Fields])
VAR Measure2 = SELECTEDVALUE(MeasureSelector2[Fields])
VAR TableWithValues =
ADDCOLUMNS (
VALUES ( 'YourData'[YourGroupingColumn] ),
"X", CALCULATE ( Measure1 ),
"Y", CALCULATE ( Measure2 )
)
VAR CorrelationResult =
CORREL ( SELECTCOLUMNS ( TableWithValues, "X", [X], "Y", [Y] ), [X], [Y] )
RETURN
CorrelationResult
Replace 'YourData'[YourGroupingColumn] with the dimension over which you want to calculate correlation (e.g., Date, Customer, etc.)
Please let me know if this works by giving a thumbs up and marking as solved, thanks
Thanks Wardy, but CORREL is not a PBI function. I just want to use the code which is generated by the quick measure, and choose my 2 measures as variables in that code..
That is not currently supported. If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
20 | |
11 | |
10 | |
9 | |
7 |