Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am creating a bar chart to display today's sales/orders and yesterday's orders, using "Hours" as the dimension (time, but I'm only taking the hours from it).
However, I keep getting the same data for both, and I am getting the full data, such as 1 hour for 6th September, which should only show 5k as an example.
How can I fix this?
here is what im using
if(Var2 = 1,
if(Var1 = 2,
Sum({
<Date = {"=$(=Date(Today()))"}>
} Sales)
),
if(Var2 = 2,
if(Var1 = 2,
Count({
<Date = {"=$(=Date(Today()))"}>
} DOCNO)
)
)
)
whats the granularity of the data? is it by date, by hour ? if you wanna display the hourly data make sure you have hour level granularity in the tables. provide some sample data so i can replicate the scenaio.
To display today's and yesterday's sales/orders separately in a bar chart using "Hours" as the dimension, you need to filter the data based on the date range. Here's how you can modify your expression:
For today's sales:
Sum({<Date = {$(=Date(Today()))}>} Sales)
For yesterday's sales:
Sum({<Date = {$(=Date(Today()-1))}>} Sales)
Replace "Sales" with the appropriate field name for orders if you want to display order counts instead.
To use these expressions in a bar chart:
1. Add "Hours" as the dimension.
2. Create two measures:
- Measure 1: Today's Sales/Orders (use the first expression)
- Measure 2: Yesterday's Sales/Orders (use the second expression)
3. Add both measures to the bar chart.
This will create separate bars for today's and yesterday's data, grouped by the "Hours" dimension. The set analysis expressions filter the data to include only records for the respective dates.