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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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

Click here to schedule a short Teams meeting to discuss your question.

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

Click here to schedule a short Teams meeting to discuss your question.
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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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