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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
janhaviqut3009
Frequent Visitor

Power BI custom column

I have two columns Current 1 and Current 2, i want the custom column to start with 0's and increment to 1, 2,3... when the conditions are true in both the columns and the conditions are when Current 1 =0 and Current 2 >0. Ideally i want my custom columns to look like 000000011112222233333444..... and increment each time the condition is met

3 REPLIES 3
janhaviqut3009
Frequent Visitor

Hi, thank you for your code! It says theres not enough memory to complete this operation. Please try again later when there may be more memory available?

Hi @janhaviqut3009 ,
This problem may be caused by insufficient system resources, such as low random access memory (RAM) or a slow computer processor. You can fix this error by freeing up memory in Power BI by closing other applications and processes. If the data model is too complex or contains unnecessary data, it can strain system resources and cause the application to crash.
To optimize the data model, first remove any unnecessary columns or tables. You can also try splitting large tables into smaller ones or using filters to limit the amount of data loaded into memory.
Additionally, consider using calculated columns instead of metrics, as they are less resource-intensive and can improve performance and reduce the risk of memory allocation failures.

You can refer to this document
How to Fix Memory Allocation Error in Power BI Desktop - Monocroft

Best regards,
Albert He

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

v-heq-msft
Community Support
Community Support

Hi @janhaviqut3009 ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1715825018701.png

Open power query and add a index column

vheqmsft_1-1715825056338.png

Close and apply then create columns

 

 

Result = 
IF(
    'Table'[Current 1] = 0 && 'Table'[Current 2] > 0,
    1,
    0
)
Outpput = 
CALCULATE(
    SUM('Table'[Result]),
    FILTER(
        'Table',
        'Table'[Index] <= EARLIER('Table'[Index])
    )
)

 

 

Final output

vheqmsft_2-1715825162631.png

Best regards,
Albert He

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

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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

Users online (1,860)