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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.