cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Teige_Gao
Frequent Visitor

What's the better method to create a qtd,ytd calculated column?

Hi Community,

 

What's the better way to create a calculated column for qtd, ytd, mtd. etc?

 

We're creating a calculated column for qtd with query like below:

 

 

 

qtd = calculate(sum(value),filter(table_name, quarter = eariler(quarter)&&year = eariler(year)))

 

 

 

It raised an error message:

 

There's not enough memory to process this operation.

 

The size of pbix is 203M. So, can we find a better method to create this calculated column like using qtd, mtd function?

 

Best Regards,

Teige

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Teige_Gao ,

 

Calculated columns take up memory, while measures take up CPU.

 

DAX has built-in function TOTALQTD, TOTALMTD, TOTALYTD to calculate QTD, MTD, YTD, please refer to: https://msdn.microsoft.com/en-us/query-bi/dax/time-intelligence-functions-dax. For more details about when to use these functions and how to use these functions, please refer to: https://www.mssqltips.com/sqlservertip/4841/calculating-mtd-qtd-ytd-running-and-cumulative-total-in-....

 

 

Also please filter your resource table, and just load the necessary data. There are some tips about managing Memory, you can review them in this similar thread.

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

5 REPLIES 5
v-stephen-msft
Community Support
Community Support

Hi @Teige_Gao ,

 

Calculated columns take up memory, while measures take up CPU.

 

DAX has built-in function TOTALQTD, TOTALMTD, TOTALYTD to calculate QTD, MTD, YTD, please refer to: https://msdn.microsoft.com/en-us/query-bi/dax/time-intelligence-functions-dax. For more details about when to use these functions and how to use these functions, please refer to: https://www.mssqltips.com/sqlservertip/4841/calculating-mtd-qtd-ytd-running-and-cumulative-total-in-....

 

 

Also please filter your resource table, and just load the necessary data. There are some tips about managing Memory, you can review them in this similar thread.

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

Thanks for you replyment

parry2k
Super User
Super User

@Teige_Gao this seems like a different problem, shouldn't take that long, the calculated column is not going to be the solution, let's be very clear on this. The measure is a way to go.

 

Do you have a date dimension in your model?

 

 






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





parry2k
Super User
Super User

@Teige_Gao why do you want a column? Why measure will not work?






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





Thanks for reply, measure is not work in my scenario, the data granularity is qtd, ytd, mtd. etc. But based on the organization data management standard, we can't calculate them in database, as a result, we need to calculate them in PBI end. But if we use measure, it takes more than 10s to refresh a report

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors