Compare group of values

Hi,
I has raport like on screenshot. I’m looking for mdx query to check that any value in column “Zadanie Dni” for “Sprzedaz” is bigger then any value in this column for “Zakup”. If yes, then on issue number level (in this case BWPS-19) I would like to dipslay 1, to filter cases when we have to paid for devices befor customer paid us.
report

I am sharing the example formula. I used a custom hierarchy in Issue dimension for this example. You would like to update it using your hierarchy name, level names, member names, and measures.

I have custom hierarchy in Issue dimension with the name Epics and types name and levels Epic, Issue type, Parent:
image

I have a property Issue Quatation I am using for this comparison. I also using a measure Issues created for filtering based on report selections.

Here is my formula how I counted Issues in group Story with higher value than any issue in group Bug. I addressed the Issue dimension hierarchy Epics and types on Level Parent for a group Story. For any issue in this group I compared a value of Quatation with the Max value of the same property in the group Bug of the same Epic ([dimension name].currentmember.parent.parent goes up two levels in hierarchy, in my case from a level Parent to higher level Epic):

NonZero(Count(
  Filter(
    Descendants([Issue.Epics and types].CurrentMember,[Issue.Epics and types].[Parent]),
    [Issue.Epics and types].CurrentMember.Parent.Name = "Story"
    AND
    [Measures].[Issues created] > 0 -- any measure for filtering
    AND
    [Measures].[Issue Quotation] >
    MAX(
      Filter(
      Descendants([Issue.Epics and types].CurrentMember.Parent.Parent,[Issue.Epics and types].[Parent]),
      [Issue.Epics and types].CurrentMember.Parent.Name = "Bug"),
      [Measures].[Issue Quotation]
    )
  )
))

Daina / support@eazybi.com