Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register 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...
User | Count |
---|---|
84 | |
76 | |
64 | |
51 | |
46 |
User | Count |
---|---|
101 | |
42 | |
41 | |
39 | |
36 |