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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cosminc
Post Partisan
Post Partisan

Insert custom rows

Hi all,

is it posible to add rows in a base like this:

 

IDYearMonthClientLabelValueconcatenate ID&Client
120181cosminA11cosmin
120181cosminB11cosmin
120181cosminC11cosmin
120181cosminD01cosmin
220182cosminA02cosmin
220182cosminB12cosmin
220182cosminC12cosmin
220182cosminD02cosmin
320181anaA03ana
320181anaB03ana
320181anaC03ana
320181anaD13ana
420183anaA04ana
420183anaB14ana
420183anaC14ana
420183anaD14ana
add custom rows     
120181cosminZ01cosmin
220182cosminZ02cosmin
320181anaZ03ana
420183anaZ14ana
If(Value for C=1 ann D=1 --value for new row is 1, otherwise os 0

 

the real base has thousands of rows and need to make something for each ID&Client

any idea?

Thanks,

Cosmin

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi COSMINC,

You could try to new custom row table by DAX like below

 

custom rows =
SUMMARIZE (
    cutsom,
    cutsom[ID],
    cutsom[Year],
    cutsom[Month],
    cutsom[client],
    cutsom[concatenate ID&Client],
    "value", IF (
        CALCULATE (
            SUM ( cutsom[Value] ),
            FILTER (
                ALLEXCEPT ( cutsom, cutsom[ID] ),
                cutsom[Label] = "C"
                    || cutsom[Label] = "D"
            )
        ) = 2,
        1,
        0
    ),
    "Label", "Z"
)

17.png

Then  use selectcolumn  and union syntax to combine two table like below

Table 2 =
UNION (
    cutsom,
    SELECTCOLUMNS (
        'custom rows',
        "id", 'custom rows'[ID],
        "year", 'custom rows'[Year],
        "Month", 'custom rows'[Month],
        "client", 'custom rows'[client],
        "lable", 'custom rows'[Label],
        "value", 'custom rows'[value],
        "con", 'custom rows'[concatenate ID&Client]
    )
)

18.png

Best Regards,

Zoe Zhi

 

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

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi COSMINC,

You could try to new custom row table by DAX like below

 

custom rows =
SUMMARIZE (
    cutsom,
    cutsom[ID],
    cutsom[Year],
    cutsom[Month],
    cutsom[client],
    cutsom[concatenate ID&Client],
    "value", IF (
        CALCULATE (
            SUM ( cutsom[Value] ),
            FILTER (
                ALLEXCEPT ( cutsom, cutsom[ID] ),
                cutsom[Label] = "C"
                    || cutsom[Label] = "D"
            )
        ) = 2,
        1,
        0
    ),
    "Label", "Z"
)

17.png

Then  use selectcolumn  and union syntax to combine two table like below

Table 2 =
UNION (
    cutsom,
    SELECTCOLUMNS (
        'custom rows',
        "id", 'custom rows'[ID],
        "year", 'custom rows'[Year],
        "Month", 'custom rows'[Month],
        "client", 'custom rows'[client],
        "lable", 'custom rows'[Label],
        "value", 'custom rows'[value],
        "con", 'custom rows'[concatenate ID&Client]
    )
)

18.png

Best Regards,

Zoe Zhi

 

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

Thanks,

very very helpfull!

Cosmin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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