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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
lisannegesch
Frequent Visitor

Make a measure instead of a calculated column

Hi,

 

Due to performance issues I'm trying to use a measure instead of a calculated column. Now the column 'TotaalFout' is calculated in M (but maybe is in DAX better?) with the following logic: = Table.AddColumn(Table, "TotaalFout", each if [te_groot_bbp] = 1 then 1 else if [te_groot_pakket] = 1 then 1 else if [te_zwaar_bbp] = 1 then 1 else if [te_zwaar_pakket] = 1 then 1 else 0)

 

There is an exception that if it's te_groot (too big) AND te_zwaar (too heavy) it still calculates 1 beacause it's subject which the errors is about, is still one. This results in the follwing column:

 

lisannegesch_0-1667389389314.png

 

The next step, why I find it hard to find a measure is that I use the sumfunction in the visual  The collected data is dependend of dates. And I selected sum te_groot, te_zwaar and TotaalFout (etc..). 

 

lisannegesch_1-1667389709243.png

 

Does anyone has suggestions which kind of measure I could use? 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lisannegesch ,

According the formula: = Table.AddColumn(Table, "TotaalFout", each if [te_groot_bbp] = 1 then 1 else if [te_groot_pakket] = 1 then 1 else if [te_zwaar_bbp] = 1 then 1 else if [te_zwaar_pakket] = 1 then 1 else 0)

 

Please have a try.

Create a measure:

TotaalFout =
IF (
    MAX ( table[te_groot_bbp] ) = 1
        || MAX ( table[te_groot_pakket] ) = 1
        || MAX ( table[te_zwaar_bbp] ) = 1
        || MAX ( table[te_zwaar_pakket] ) = 1,
    1,
    0
)

 

If I have misunderstood your meaning, please provide more details with desired output and pbix file without  privacy information.

 

Best Regards

Community Support Team _ Polly

 

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
Anonymous
Not applicable

Hi @lisannegesch ,

According the formula: = Table.AddColumn(Table, "TotaalFout", each if [te_groot_bbp] = 1 then 1 else if [te_groot_pakket] = 1 then 1 else if [te_zwaar_bbp] = 1 then 1 else if [te_zwaar_pakket] = 1 then 1 else 0)

 

Please have a try.

Create a measure:

TotaalFout =
IF (
    MAX ( table[te_groot_bbp] ) = 1
        || MAX ( table[te_groot_pakket] ) = 1
        || MAX ( table[te_zwaar_bbp] ) = 1
        || MAX ( table[te_zwaar_pakket] ) = 1,
    1,
    0
)

 

If I have misunderstood your meaning, please provide more details with desired output and pbix file without  privacy information.

 

Best Regards

Community Support Team _ Polly

 

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

 

PhilipTreacy
Super User
Super User

Hi @lisannegesch 

 

I don't understand what it is you are trying to achieve.  In your final table, what values do you want in the TotaalFout column?

 

Please share your data/file - at least a subset of data so we don't have to recreate the whole lot.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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