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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Save Measure-values in Table when removing Attribute-Columns

Hello,

 

I want to make a tabke only containing the first 4 key-columns and the last "Relative Frequency". I want to keep the same Relative Frequency percentages even when I remove all the attributes.

The only way I've figured out to do this is to make the table I want and then save it to Excel and then open the Excel-sheet in PowerBI and remove the attributes.

If anyone have any suggestions to do it all in PowerBI I'd be very interested in that! 🙂


This is the table I have:

Xilitor01_0-1638875580139.png


And this is what I want (with the same Relative Frequency as the image above). This is made by "Export data":

Xilitor01_1-1638875985079.png

 

I hope you can help!

Thank you 🙂

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You couldn't use the same logic of your measure to create a column. Here I update your measure and find which cause your issue.

Relative Frequency =
VAR _PART1 =
    DISTINCTCOUNT ( 'dummydata-whatIhave'[MATNR] )
VAR _PART2 =
    CALCULATE (
        DISTINCTCOUNT ( 'dummydata-whatIhave'[MATNR] ),
        ALLEXCEPT ( 'dummydata-whatIhave', 'dummydata-whatIhave'[key-combined] )
    )
VAR _RATE =
    DIVIDE ( _PART1, _PART2 )
RETURN
    _RATE

Your measure is created by Part1 and Part2, Part1 will be caculated by filter of columns in Matrix. Part1 will casue incorrect result in calculated column. You need to add the filter in your new code.

You can try this code to achieve your goal.

Table = 
VAR _AddRate =
    ADDCOLUMNS (
        'dummydata-whatIhave',
        "Rate",
            VAR _PART1 =
                CALCULATE (
                    DISTINCTCOUNT ( 'dummydata-whatIhave'[MATNR] ),
                    ALLSELECTED ( 'dummydata-whatIhave'[MATNR] )
                )
            VAR _PART2 =
                CALCULATE (
                    DISTINCTCOUNT ( 'dummydata-whatIhave'[MATNR] ),
                    ALLEXCEPT ( 'dummydata-whatIhave', 'dummydata-whatIhave'[key-combined] )
                )
            VAR _RATE =
                DIVIDE ( _PART1, _PART2 )
            RETURN
                _RATE
    )
VAR _SUMMARIZE =
    SUMMARIZE (
        _AddRate,
        'dummydata-whatIhave'[key-combined],
        'dummydata-whatIhave'[key1],
        'dummydata-whatIhave'[key2],
        'dummydata-whatIhave'[key3],
        [Rate]
    )
RETURN
    _SUMMARIZE

Result is as below.

1.png

Best Regards,
Rico Zhou

 

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

5 REPLIES 5
Fowmy
Super User
Super User

@Anonymous 

You can use SELECTCOLUMNS to create a new table keep only the required columns as follows:

New Table = 

SELECTCOLUMNS (
    Table1,
    "Combined Key", Table1[Combined Key],
    "Key1", Table1[Combined Key1],
    "Key2", Table1[Combined Key2],
    "Key3", Table1[Combined Key3],
    "Freq %", Table1[Frequency %]
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Thank you for response. The Relative Frequency is a Calculated Measure and I've been having problems making that a column. Sorry I forgot to mention that in the above description.
And if I use the Calculated Measure "Relative Frequency" in the DAX-formula to create the table it gives incorrect results.

Xilitor01_0-1638876943393.png

 

@Anonymous 

Not, clear enough, please share a sample PBIX file and the expected results. By the way I you need to calculate the frequency while create a the new table then try the following:

New Table = 
ADDCOLUMNS (
SELECTCOLUMNS (
    Table1,
    "Combined Key", Table1[Combined Key],
    "Key1", Table1[Combined Key1],
    "Key2", Table1[Combined Key2],
    "Key3", Table1[Combined Key3]
),
"Freq %", CALCULATE ( enter your freq formula here )
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hi Fowmy,

 

Thank you for your response!

 

I have selected a small part of the dataset to create the dummydata.

Please see the pbix-file below:

https://easyupload.io/ndyltg

 

I hope you can help!

Thank you once again 🙂

Anonymous
Not applicable

Hi @Anonymous ,

You couldn't use the same logic of your measure to create a column. Here I update your measure and find which cause your issue.

Relative Frequency =
VAR _PART1 =
    DISTINCTCOUNT ( 'dummydata-whatIhave'[MATNR] )
VAR _PART2 =
    CALCULATE (
        DISTINCTCOUNT ( 'dummydata-whatIhave'[MATNR] ),
        ALLEXCEPT ( 'dummydata-whatIhave', 'dummydata-whatIhave'[key-combined] )
    )
VAR _RATE =
    DIVIDE ( _PART1, _PART2 )
RETURN
    _RATE

Your measure is created by Part1 and Part2, Part1 will be caculated by filter of columns in Matrix. Part1 will casue incorrect result in calculated column. You need to add the filter in your new code.

You can try this code to achieve your goal.

Table = 
VAR _AddRate =
    ADDCOLUMNS (
        'dummydata-whatIhave',
        "Rate",
            VAR _PART1 =
                CALCULATE (
                    DISTINCTCOUNT ( 'dummydata-whatIhave'[MATNR] ),
                    ALLSELECTED ( 'dummydata-whatIhave'[MATNR] )
                )
            VAR _PART2 =
                CALCULATE (
                    DISTINCTCOUNT ( 'dummydata-whatIhave'[MATNR] ),
                    ALLEXCEPT ( 'dummydata-whatIhave', 'dummydata-whatIhave'[key-combined] )
                )
            VAR _RATE =
                DIVIDE ( _PART1, _PART2 )
            RETURN
                _RATE
    )
VAR _SUMMARIZE =
    SUMMARIZE (
        _AddRate,
        'dummydata-whatIhave'[key-combined],
        'dummydata-whatIhave'[key1],
        'dummydata-whatIhave'[key2],
        'dummydata-whatIhave'[key3],
        [Rate]
    )
RETURN
    _SUMMARIZE

Result is as below.

1.png

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.