Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jenmclean
Contributor III
Contributor III

Set Analysis : Subtract yesterday and previous day field data

I have a data set that is only Monday-Friday data that is collected from three sources.

One source has Change data but the other two do not (difference in price from previous posting, i.e. 0.0650).

I need to create an expression that will post the Change data for the one source that currently contains data, and then take the PostedPrice from yesterday minus the PostedPrice from the day before that.


For Example: Monday would show Friday Data, Tuesday will show Monday data, etc.


I'm stumped and/or overthinking it. Any thoughts or ideas?

Yellow has Change data, Blue and Orange do not.

example.png

Data Field Names:

    Term,

    Date,

    PostedPrice,

    FuelName,

    FuelType,

    Product,

    Change,

    Discount,

    Tax

2 Replies
Anil_Babu_Samineni

I think you could need qualify statement for that table and set analysis for logic where you required which is

Above(Sum(sales),1)-above(sum(sales),2)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vishsaggi
Champion III
Champion III

Can you share some sample data with expected output rather than an image. It would save time to work on sample data.

One way to restrict weekends is to using where clause just run the below query in your qvw file for a quick check.

For i = 1 to 20

Table1:

LOAD Date(Today() - $(i)) AS PrevDates,

     WeekDay(Date(Today() - $(i))) AS PrevDay,

     Date(Today() - $(i)) & '-' & WeeKDay(Date(Today() - $(i))) AS DateWeekName

AutoGenerate $(i);

Next i;

NoConcatenate

Final:

LOAD *

Resident Table1

WHERE NOT Match(PrevDay, 'Sat', 'Sun');

Drop Table Table1;