Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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"

 

  • Jimmy801's avatar
    Jimmy801
    6 years ago

    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

     

    Jimmy

16 Replies

  • AnkitBI's avatar
    AnkitBI
    Solution Sage

    Hi Anonymous 

     

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

     

    Thanks

    Ankit Jain

    • AnkitBI's avatar
      AnkitBI
      Solution Sage

      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.

    • Anonymous's avatar
      Anonymous
      Not applicable

      They are both in different tables

      • AnkitBI's avatar
        AnkitBI
        Solution Sage

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