Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Obsyky
Contributor III
Contributor III

Comparing two aggr in an if

Hello,

I want to compare two aggrs in an if, but the comparison doesn't return the result I want...

aggr1 :
aggr(Only({$<DATE_START={"<=$(=vDATE1)"},DATE_END={">$(=vDATE1)"},STATE_ID -= {'Out'}>}ATTRIBUTE),ID)
The result is -> 'XX'

aggr2 :
aggr(Only({$<DATE_START={"<=$(=vDATE2)"},DATE_END={">$(=vDATE2)"},STATE_ID -= {'Out'}>}ATTRIBUTE),ID)
The result is -> 'XX'

If :
If(aggr(Only({$<DATE_START={"<=$(=vDATE1)"},DATE_END={">$(=vDATE1)"},STATE_ID -= {'Out'}>}ATTRIBUTE),ID) = aggr(Only({$<DATE_START={"<=$(=vDATE2)"},DATE_END={">$(=vDATE2)"},STATE_ID -= {'Out'}>}ATTRIBUTE),ID),Null(),ID)
The result is -> ID
Except that as the two aggr are identical, I'll end up with a Null.

 

Why doesn't the comparison work?

Thank you very much.

Labels (1)
1 Solution

Accepted Solutions
Obsyky
Contributor III
Contributor III
Author

I've found a solution to my problem. I simply replaced the "=" between the aggr() with a "like".

Thank you very much for your help!

View solution in original post

7 Replies
Mark_Little
Luminary
Luminary

Hi,

Have broken the Set analysis down?

I.e. Created a table with Above and comparing? Ensuring that the Aggr is always bring through a single value for the only function on both sides?

Obsyky
Contributor III
Contributor III
Author

The value is unique for each id

Just that it can change according to the date, and the goal is to display only the IDs that may have changed between two dates

marcus_sommer

You may try it in this way:

If(aggr(
   Only({$<DATE_START={"<=$(=vDATE1)"},DATE_END={">$(=vDATE1)"},STATE_ID -= {'Out'}>}ATTRIBUTE) <>     
   Only({$<DATE_START={"<=$(=vDATE2)"},DATE_END={">$(=vDATE2)"},STATE_ID -= {'Out'}>}ATTRIBUTE),
ID),ID)

Obsyky
Contributor III
Contributor III
Author

It always returns a value 😕

marcus_sommer

What happens if you put ID as dimension in a table-chart and both only() calculations without the aggr() as single expressions and a third one comparing them?

vincent_ardiet_
Specialist
Specialist

What is the dimension you are using in your chart?

Obsyky
Contributor III
Contributor III
Author

I've found a solution to my problem. I simply replaced the "=" between the aggr() with a "like".

Thank you very much for your help!