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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

calculated sum column based on another column

Hi, I'm a beginner in Power BI, and I have a table like this:

 

mhv22_0-1648520393078.png

I need a calculated column, with the total distinct values of 'Talle' column, if value in existencia is equal to 1. In the image above, the result should be 8, because there are 9 unique different values, but only 8 have 1 in 'Existencia' ( Talle= 3 , has Existencia=0). It' important to consider that , the same must be done for each Parent Item. Maybe in another Parent Id values, I could have the same values in 'Talle' Column. How could it be done? . Thanks in advance!!!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Try like

 

calculate(distinctCOUNT(Table[Talle]), filter(Table, Table[existencia] =1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

Picture2.png

 

Distinct count of Talle CC =
COUNTROWS (
    SUMMARIZE (
        FILTER (
            Data,
            Data[Existencia] = 1
                && Data[Parent_Item] = EARLIER ( Data[Parent_Item] )
        ),
        Data[Talle]
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

9 REPLIES 9
ribisht17
Super User
Super User

You are using DAX, not Power Query Formula Language. See Create calculated columns for more information.

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

Picture2.png

 

Distinct count of Talle CC =
COUNTROWS (
    SUMMARIZE (
        FILTER (
            Data,
            Data[Existencia] = 1
                && Data[Parent_Item] = EARLIER ( Data[Parent_Item] )
        ),
        Data[Talle]
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Anonymous
Not applicable

Thanks a lot @Jihwan_Kim , you really  helped me ! 

amitchandak
Super User
Super User

@Anonymous , Try like

 

calculate(distinctCOUNT(Table[Talle]), filter(Table, Table[existencia] =1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak , It's not considering different Parent_Item  :

mhv22_0-1648522855975.png

 

@Anonymous , try to create as a measure

 

new column as

calculate(distinctCOUNT(Table[Talle]), filter(Table, Table[existencia] =1 && [Parent_Item] = earlier([Parent_Item] ) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

thanks a lot @amitchandak , you really  helped me ! 

Anonymous
Not applicable

Hi, @amitchandak . Thanks for the answer! I 'm getting this error:

mhv22_0-1648522382423.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.