Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
83 | |
78 | |
54 | |
39 | |
35 |
User | Count |
---|---|
98 | |
80 | |
50 | |
48 | |
48 |