March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Solved! Go to Solution.
Hi @rmsaunders,
Do you have any performance issue? Or just want to compact the formula? If so, please try out this one.
calc_TY_Sales_YTD = VAR var_Metric = SELECTEDVALUE ( table_Sales_Metrics[Metric] ) VAR var_TY_sales_YTD = CALCULATE ( SWITCH ( var_Metric, "Units", SUM ( SALES_TABLE[qty_sold] ), "Cost $", SUM ( SALES_TABLE[dollar_sold] ), "Retail $", SUM ( SALES_TABLE[retail_sold] ) ), DATESBETWEEN ( DATE_TABLE[date], [calc_Report_Start_Date], [calc_Report_End_Date] ) ) RETURN var_TY_sales_YTD
If it doesn't help, please provide a sample that we can download or copy with. Please mask the sensitive parts first.
Best Regards,
Hi @rmsaunders,
Do you have any performance issue? Or just want to compact the formula? If so, please try out this one.
calc_TY_Sales_YTD = VAR var_Metric = SELECTEDVALUE ( table_Sales_Metrics[Metric] ) VAR var_TY_sales_YTD = CALCULATE ( SWITCH ( var_Metric, "Units", SUM ( SALES_TABLE[qty_sold] ), "Cost $", SUM ( SALES_TABLE[dollar_sold] ), "Retail $", SUM ( SALES_TABLE[retail_sold] ) ), DATESBETWEEN ( DATE_TABLE[date], [calc_Report_Start_Date], [calc_Report_End_Date] ) ) RETURN var_TY_sales_YTD
If it doesn't help, please provide a sample that we can download or copy with. Please mask the sensitive parts first.
Best Regards,
v-jiascu-msft:
I just wanted to compact the formula, and your solution has done that.
Thanks!
Hmm, probably a better way, can you share sample data that can be copied and pasted so that I can try a few things? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490.
Also, there are some techniques here that might help.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |