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: 
leon511920
Contributor III
Contributor III

Scatter plot

Hi,

I'm trying to create a scatterplot with two measures and one axis.
I want to display the data only for the latest date, but it doesn't work. I am using "max(date)" to get the latest date data, but I'm using it for the axis, so I get an error.
(ex: If(date = max(date), customer) )
The data I want to use are: 

Axis: customer, (date (I want to get the latest value))
Measure: sales, region

How can I make it work?

6 Replies
vinieme12
Champion III
Champion III

At the moment you have two Dimensions Region and Customer  and one Measure Sales

One would ideally restrict the data in the Measures using Set Analysis as below

 

X-Axis  =   Sum({<Datefield={"$(=Date(Max(Date)))"}>}Sales)

Y-Axis  =   Sum({<Datefield={"$(=Date(Max(Date)))"}>}SomeOtherMEasure)

DataPoints =  Customer

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
leon511920
Contributor III
Contributor III
Author

thank you!

I tried to get the maximum value of the date with max in the load script, but an error occurred.
Can I use the max function in the load script like below?

ex)
Load.....
Max([date]) as [max_date]

Resident Sales
Group by xxx;

vinieme12
Champion III
Champion III

can you post your actual script and the a screenshot of the error message you received

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
leon511920
Contributor III
Contributor III
Author

It worked fine up to the point of calculating the maximum and second value of the date in the load script,
The part of the script that takes the difference of the values (Diff) doesn't work.

スクリーンショット 2023-02-14 18.15.35.png

vinieme12
Champion III
Champion III

The Error is because the fields [first] and [second] do not exist in table Temp1

The Max table should be joined to Temp1

Add the below highlighted to add [first] and [second] to Temp1 table

 

Temp1:

Load ...... resident Sales;

Left Join(Temp1)

Load id,...[first],.....[second]

Resident Temp1

Group by id;

 

Diff:

load 

.......

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
leon511920
Contributor III
Contributor III
Author

Thank you so much! This solved the problem!
and I wanna add other data from other table. 


When I load the data it gets stuck here and doesn't progress for more than a few minutes.
Is it possible? 


screen.png