How to create a measure to count different numbers?

0

I'm new to this power bi world and I'm in need of a help, it may be basic what I'm going to ask.

I have a spreadsheet in excel that gives me more or less structure.

Protocolo                     Pedido       Item

ACC003.2018.PRISMA.17773959 | 5100712439 | 10
ACC003.2018.PRISMA.17773959 | 5100712439 | 20
ACC003.2018.PRISMA.17773959 | 5100712439 | 30
ACC003.2018.PRISMA.17773959 | 5100712439 | 40
ACC003.2018.PRISMA.17938855 | 5100714674 | 10
ACC003.2018.PRISMA.17938855 | 5100714674 | 20
ACC003.2018.PRISMA.17938855 | 5100714674 | 30
ACC003.2018.PRISMA.17938855 | 5100714675 | 10
ACC003.2018.PRISMA.17938855 | 5100714676 | 10
ACC003.2018.PRISMA.17938855 | 5100714677 | 10
ACC003.2018.PRISMA.17938855 | 5100714678 | 10
ACC003.2018.PRISMA.17938855 | 5100714678 | 20
ACC003.2018.PRISMA.17938855 | 5100714679 | 10
ACC003.2018.PRISMA.17938855 | 5100714679 | 20
ACC003.2018.PRISMA.17938855 | 5100714680 | 10
ACC003.2018.PRISMA.17938855 | 5100714681 | 10
ACC003.2018.PRISMA.17938855 | 5100714682 | 10
ACC003.2018.PRISMA.17938855 | 5100714683 | 10
ACC003.2018.PRISMA.17938855 | 5100714683 | 20

If you notice correctly, you can see that the protocol repeats for the request, as it has an item for the request.

What I want to tell you is the number of requests, for example, in this excel file that I shared, I would have 11 different requests

    
asked by anonymous 22.10.2018 / 16:40

1 answer

3

@RodrigoMel was right, you have to group twice:

The first can be grouped by sum ( Items ) to eliminate duplicates in Pedidos .

The second has to group with two conditions one that counts the Pedidos and the second that adds the Items .

AdvancedEditor(PowerMcode):

letSource=Excel.Workbook(File.Contents("C:\Users\david\Desktop\stack.xlsx"), null, true),
    Table2_Table = Source{[Item="Table2",Kind="Table"]}[Data],
    #"Grouped Rows" = Table.Group(Table2_Table, {"Protocolo", "Pedido"}, {{"Item", each List.Sum([Item]), type number}}),
    #"Grouped Rows1" = Table.Group(#"Grouped Rows", {"Protocolo"}, {{"Count", each Table.RowCount(_), type number}, {"Item", each List.Sum([Item]), type number}})
in
    #"Grouped Rows1"
    
24.10.2018 / 19:54