Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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.

 

 

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?

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


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?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.