Forum Discussion
Query Regarding Dynamic Queries
- 11 months ago
Hey ANVS ,
You could set up calculation groups with two calculation items for PC and UC. Then, the calculation items you could switch between measure names as follows:
PC = SWITCH(SELECTEDMEASURENAME(),"Revenue", [PC_Revenue],"Profit", [PC_Profit],"Units", [PC_Units],"Margin", [PC_Margin],"Avg Order Value", [PC_AvgOrderValue],BLANK())
Well here is where you would keep the 50-60 measures you have for PC and in another calculation item for UC you would keep the ones for UC. Common measures will share the same name. For the sake of clean implementation, you could add generic measures like Revenue = BLANK() and the calculation groups will handle replacing that with the required value when you make the calculation group choice. Here are some screenshots of a sample implementation:Basically whenever it finds a measure named Revenue it swaps it with UC_Revenue when you have UC selected. And similar for PC.
Hope it helps! - 11 months ago
- ✅ Create a disconnected table with values PC and UC
- ✅ Add a slicer using that table
- ✅ Write a dynamic measure like this:
Dynamic_Measure =
SWITCH(
SELECTEDVALUE(MeasureSelector[Type]),
"PC", [PC_Measure],
"UC", [UC_Measure]
)
Use Dynamic_Measure in all visuals instead of separate PC/UC measures. Clean, scalable, and no duplication needed.
Hi ANVS ,
Could you let us know if your issue has been resolved or if you are still experiencing difficulties? Your feedback is valuable to the community and can help others facing similar problems.
- ANVS11 months agoAdvocate II
Yes, Resolved
- V-yubandi-msft10 months agoCommunity Support
Thank you for confirming, ANVS . If you can, please mark the response that resolved your issue. This will help others in the community find solutions more easily.
Regards,
Yugandhar.