Orange3: lat/lng data geocoded with discretized date -> Average result value per year per continent - geocoding

I have data that has:
a result value
A lat & lng
a date
I have discretized the date to years which works fine. I have used the Geocoding add-on to extract the continent from the lat/lng coords. And now I want to get the average result value of the continent per year. I'm at the point where I have all the values available, but I can't figure out how to group the result (mean)by continent-year categories.
I have set up the following flow.
The table you see above comes from the red square
enter image description here
enter image description here

Related

Wrong calculations for rows in Power BI matrix

I am trying to calculate market share, but struggling with doing it correctly.
I have a matrix where I have Category, Name as rows, Channel as column, and Market Share as value.
Also In my dataset I have columns ABS_COMPANY (with sales inputted there if company = "A", so there are some blank ones), and ABS_TOTAL (with sales inputted in each row)
so my measure Market Share:
Market Share = SUM(table\[ABS_COMPANY\]) / SUM(table\[ABS_TOTAL\])
This correctly calculates values for each Category, but when I open the drop-down to see Name, Market Share of each Name equals to 100%. What is the problem and how to fix it?
e.g. What is now:
Market Share
Pens 43%
pen 1 100%
pen 2 100%
pen 3 100%
Pencils 29%
penc 1 100%
penc 2 100%
penc 3 100%
I've tried using Calculate(), but it does not work in a way I want to.
Unfortunately, I cannot share the data as it is sensitive.
Structure of dataset:
NAME STRING
CATEGORY STRING
CHANNEL STRING
ABS_COMPANY DECIMAL(20,2) - value of sales for each name
ABS_TOTAL DECIMAL(20,2) - it is a value grouped by CHANNEL AND CATEGORY at the backend

DAX & Power Query - Removing transaction line if sale is returned

First time posting, thanks in advance !
I have a simple sales table acting as a data source.
In this table I have all my dimensions and facts, the data model is not organized as a star schema.
I believe this question does not require the data model to be optimally built.
One column tracks the Sales Quantity and shows -1 if the item is returned.
In Power Query.
I wish, for all returns, to eliminate the line with the -1, but also the associated line with the +1 sale.
I do not wish to simply filter by the Invoice Number and remove it, as in the same invoice I may have other items who were not returned.
I wish to have in my final table only final records.
Thank you
Did not manage to identify a way to tackle the issue in Power Query as of yet.
Edit, addition of further context
Dataset abstract:
I would like to keep the green row and remove the yellow ones.
One invoice features three lines, two for one item being sold and returned, and one for an item being purchased for good. That latter one is to stay in the records.
[IMAGE : Excel version of relevant column in data base ]
https://i.stack.imgur.com/CiiiC.png
Because I do not know the exact nature of your data, I will give you a general solution for your problem, which will help you immensely.
First, I will transform your data into facts and questions. Then I will answer the questions depending on my experience analyzing many different datasets; last but not least, I will provide you with the solution.
Facts,
[Sales Amount Include Tax] column values for Return Sales are negative numbers because excel format negative numbers by including them with parentheses, as your data shows.
The Original Sale record and the Return Sale record must have the same values for these columns, which we will use to know the Original Sales record:
The absolute value for the [Sales Amount Include Tax] column.
[Invoice No], [Department], [Sub Dept], [Sub Dept GROUP], [Item Code] columns.
This point is critical because we will use these columns to know the Original Sales record.
Questions,
Is the Item code column value similar to the original sale row and the returned sales row?
My answer: It should be because you are returning the same item that the Item code column describes, but I am concerned that your data shows that the first two rows don't have the same Item code. Is it by mistake?
Is the Sales Quantity column always filled with -1, even if the original sales quantity was, for example, three pairs of shoes?
My answer: The Sales Quantity column should describe the number of items someone bought, so if I originally bought 2 things but didn't like them for a reason, I will return two items so that the column value will be -2.
If my above assumptions are correct, you need to do the following in the Power BI query:
1. Import your Sales table to Power BI. See this image that shows the test data I used.
2. When you import your data and see it in the Power Query Editor, you will see that the Sales Amount Include Tax column value shows minus rather than parentheses for Return Sales Rows, as you can see in this image.
3. Create a copy of your Sales table and Rename it to Returned Sales, then filter this table to include only [Sales Amount Include Tax] that are less than 0, as you can see in this image.
4. Filter the Sales table to include only [Sales Amount Include Tax] greater than or equal to 0, as you can see in this image.
P.S. Now comes the fun part :)
1. In Returned Sales table, add a custom column name it ReturnedSaleFlag, then give it a value of 1, as you can see in this image.
2. Change ReturnedSaleFlag column type to Whole number.
3. In Returned Sales table, transform [Sales Amount Include Tax] to an Absolute Value, as you can see in this image.
4. Now you need to return to the Sales table and merge it with Returned Sales table using multiple columns which are the column listed in the second point of the fact section, as the image shows. Also, see this link that describes how to Merge query based on multi columns.
5. Expanded the new Returned Sales column in Sales table and only select ReturnedSaleFlag column and make sure to remove the check from use original column name as a prefix, as the image shows.
6. Finally, all your previous hard work created a flag in your Sales table that will let you know the Sales record that had been returned. :)
7. Now you filter the Sales table to keep the records that only have null values for the new ReturnedSaleFlag column then remove this column, as the image shows.
8. In the end save and apply and analyze your Sales and your extra info in the Returned sales.
I hope I helped in a way; if so, please mark this as an answer and vote for it :)

If the measure value is Blank, rather show the most recent value that will not make the measure Blank based on 2 different Dates

I want my measure to display a value and not a Blank, but currently, there are two Dates that are affecting my outcome. Calculation Date and my Percentile Date.
Calculation Date is used for the overall report and it goes up until 09/02/2023
Percentile Date is specifically used in that 75thpercentile_measure calculation and goes up until 01/01/2023
My goal is to create a measure that does not go, Blank, when the Calculation Date is higher than the Percentile Date it just shows Blank in the card, but would like it to instead of going blank rather show the value of the Most Recen Calcualtion Date which is = to the Percentile Date.
It will always show blank when the Calculation Date is higher than 01/01/2023 but when they are equal or Calculation Date is lower than Percentile Date it will show the percentage values of the given days.
Sample Value of 75thpercentile_measure: 8.88%
Desired Output Measure =
IF(
ISBLANK([75thpercentile_measure])
,CALCULATE(
[75thpercentile_measure]
,overall_data[Calculation Date]=[Max Percentile Date Measure]
)
,[75thpercentile_measure]
)
If I still don't make any sense just comment below so I can clarify.

How to plot maximum/minimum value plot for selected item's category

Table 1:
Date
Item
Sales Amont
10/01/2021
Apple
300
10/02/2022
Orange
700
20/03/2022
Carrot
300
21/03/2022
Onion
800
Table 2:
Date
Item
Category
Sales Amount
10/01/2021
Apple
Fruits
300
20/02/2022
Carrot
Vegetable
800
10/02/2022
Orange
Fruits
700
21/03/2022
Onion
Vegetable
200
Relationship: Table1[Item] and Table2[Item] are connect using Many to many relationship.
Im trying to plot three lines of graph for table 1.
Line 1- Represents the maximum sale amount based on its category(category value retrieved from selected value of item displayed in slicer)
Line 2 – Represents the sale amount of selected item over the date.
Line 3 -- Represents the minimum sale amount based on its category(category value retrieved from selected value of item displayed in slicer)
My Problem is
Unable to plot the maximum/minimum sale amount line based on the slicer item category.
When you change the item in the slicer, the maximum/minimum line chart must be updated based on the selected item category, but in this case, the lines change based on the selected item value rather than the max/min value.
My Question is:
How to plot the maximum/minimum value chart only based selected item’s category.
Example :
If I choose the apple in the slicer, the maximum/minimum plot will show the maximum and minimum value of the fruits category.
Based on your comment I've given it a try.
First, I've modified the model to be closer to a typical PowerBI model. It makes everything much easier. Namely:
I've converted Table2 into a Category table.
I've created a Calendar table.
The new Category table looks like that:
Item
Category
Apple
Fruits
Carrot
Vegetable
Orange
Fruits
Onion
Vegetable
The calendar table is just a table expression:
Calendar = CALENDAR(DATE(2022, 01, 01), DATE(2022, 03, 31))
I end up with a model looking like this:
Then, regarding your calculations:
Line 1- Represents the maximum sale amount based on its category(category value retrieved from selected value of item displayed in slicer)
Cat_MaxSalesAmount =
MAXX(
Sales,
Sales[Sales Amont]
)
Line 2 – Represents the sale amount of selected item over the date.
Sales_AllCategories =
CALCULATE(
SUM(Sales[Sales Amont]),
ALL(Category[Category])
)
Line 3 -- Represents the minimum sale amount based on its category(category value retrieved from selected value of item displayed in slicer)
Cat_MinSalesAmount =
MINX(
Sales,
Sales[Sales Amont]
)
I've tried it in table visualisation and the different calculations are modified by the filters.

Need SAS Code for Data validation after delimited values

i have data set like
Car Make Model Type Origin Seat MRP Show Room Price Rate Star
Acura|MDX|SUV|Asia|All|$36,945|$33,337|3.5|
Acura|RSX Type S 2dr|Sedan|Asia|Front|$23,820|$21,761|2|
result value assisgn column as per result shown
Expected Result
Car Make Model Type Origin Seat MRP Show Room Price Rate Star
Acura MDX SUV Asia All $36,945 $33,337 3.5
Acura RSX Type S 2dr Sedan Asia Front $23,820 $21,761 2
i want two code one is upload note pad file from desktop
another is assisgn in data set in data lines and input