cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Differrance betwee two values in rows

Hi,

I got the follwing issue.

 

in a table i got a number of maximum times allowed.

In a other table i got the times given.

 

Now i want to see all rows where the given times are greater than the allowed times.

So for example, the lower line is teh one i want to see as "check" because the values "max omvang...." is smaller than the "aantal afgegeven"

 

Knipsel.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Differrance betwee two values in rows

Hello @Anonymous 

 

the solution I proposed is Power Query. That what you are stating is DAX. 

If the DAX solution is okay, go for it. 

However, if you are copying my code into the advanced editor, it should not spin. Is a straightforward code. This is the result of combining the example data in my code

image.png

 

Jimmy

View solution in original post

16 REPLIES 16
Highlighted
Super User I
Super User I

Re: Differrance betwee two values in rows

Hi @Anonymous 

 

Are both Columns for Maximum Times allowed and Times given in same table or different tables?

 

Thanks

Ankit Jain

Highlighted
Super User I
Super User I

Re: Differrance betwee two values in rows

Hi @Anonymous 

If in Same table, then use below.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8i8tccovzUtR0lGK8vQDkobGECJWh36S+OTMCBlqphQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [ColA = _t, ColB = _t, TimesAllowed = _t, MaxTimesAllowed = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ColA", type text}, {"ColB", type text}, {"TimesAllowed", Int64.Type}, {"MaxTimesAllowed", Int64.Type}}),
    IsTimesAllowedGreater = Table.AddColumn(#"Changed Type","IsGreater",each if ([TimesAllowed] > [MaxTimesAllowed]) then "Y" else "N",type text),
    #"Filtered Rows" = Table.SelectRows(IsTimesAllowedGreater, each ([IsGreater] = "Y"))
in
    #"Filtered Rows"

 

Thanks
Ankit Jain
Do Mark it as solution if the response resolved your problem. Do Kudo the response if it seems good and helpful.

Highlighted
Anonymous
Not applicable

Re: Differrance betwee two values in rows

They are both in different tables

Highlighted
Super User I
Super User I

Re: Differrance betwee two values in rows

Hi @Anonymous  Can you share sample data from both table in that case.

Highlighted
Anonymous
Not applicable

Re: Differrance betwee two values in rows

Not sure how,

There is a table called "Codering max trances" with two collums "Productcode" and "max omvang"

This got a relation with a table called "DimVoorziening" on productcode.

The table "DimVoorziening"has a relation with a table called "FeitNVTZ" on a unique codenumber, different from the productcode.

Finaly there is a relation from "FeitNVTZ"to a table called "FeitLevering"

This last table contains the values of the the given form collum "aVolume"

 

So what i need is the difference between

"Codering max trances"[max omvang] - "FeitLevering"[aVolume]

Then, when the value is 0 or less than zero i want to filter on those values so someone can get in contact with the company's which has more trances than the max volume.

Highlighted
Super User I
Super User I

Re: Differrance betwee two values in rows

Hi @Anonymous 

You can share sample data from 4 tables based on one Productcode. Won't be able to help without the sample data. Someone else might be able to help.

 

Thanks

Ankit Jain

 

Highlighted
Community Support
Community Support

Re: Differrance betwee two values in rows

Hi H_Delwel,

If possible, could you please inform me more detailed information (such  as your sample data an your expected output)? Then I will help you more correctly.

 

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
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.

Highlighted
Anonymous
Not applicable

Re: Differrance betwee two values in rows

Can you do somthing with this?

The last collum(H)  is what i'm trying to make from the two different tables (FeitLevering and CoderingMaxTrances)

So value maxOmvang minus aVolume

 

 

Knipsel.PNG

Highlighted
Community Support
Community Support

Re: Differrance betwee two values in rows

Hi H_Delwel,

Yes, I will try to get the result of your image, but if possible, could you please show me the four table samples instead of showing the data in same visual, I need to know their structure and try to reproduce this in my environment.

 

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
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.

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors