Power BI: Filter sales table with multiple locations on respective start dates from different table - date

I've tried to find a similiar thread on this, but have not been able to do so. Im pretty new to Power BI, so i might not know what im looking for. I could really use some advise.
I have a sales table ('SalesTable') that contains all the sales from different store locations. The table includes all the sales from each store beginning in january 2021, but the stores was incorporated on different dates in 2021, and so i need to be able to make a filter to only return the sales for each store from when the stores was incorporated respectivaly.
Simplified, the tables looks like this:
'SalesTable'
'SalesTable'
'Stores'
'Stores'
The two tables are joined on storeID. SalesTable is also connected to a dax-created Calender table. The stores table is not connected to the calender table (Maybe it should??).
I need to be able to filter the report so that it only returns sales dated on or after the respective incorporateddate.
Like this:
'Desired output'
I am not sure whats the optimal way to go about this. If i should make a calculated table of the SalesTable, or if a measure is sufficient to filter the report. Any suggestions, tips or solutions would be highly appreciated :)

You can use this measure:
sumIncorp =
var __maxIncorp = CALCULATE(max(inc[IncorporatedDate]), FILTER(inc, inc[StoreID] = SELECTEDVALUE(IncSale[StoreID])))
return
CALCULATE(SUM(IncSale[Amount]), FILTER(IncSale, IncSale[Date] >= __maxIncorp))

Related

Tableau make one line out of two if same city name

Does anyone know if I can add two rows together so that I end up with just one row in Tableau (see screenshot)? So, if both rows are city Aachen and one row has a value for cost but not for purchasing power and the other row has a value for purchasing power but not cost, I would want just one row with both values. I am not interested in the columns "Table Name" and "Document Index(...". Thankful for any help!
Manipulating data like that in Tableau is usually no-go. Nevertheless, you can try Tableau prep and you should be able to do what you need here. Or maybe a different tool (even excel).
With that said, even though you have the info in two rows, the default approach for Tableau is always to aggregate data, so even if you have many rows with similar cases, once you take it to a viz using City (for example) as a dimension, this issue shouldn't really matter.

How do I use Tableau to populate the count of each dimension over a time period?

How do I populate the number of purchases and sales per day in tableau?
Here is my Sample Data:
In my first attempt, sales numbers are not counted to the exact date.
In my second attempt, I tried to tabulate by dropping sales date into the rows. However, it returned two figures - purchases and sales.
I have also tried Calculated Field but Tableau is unable to do a "for loop" like python.
First attempt:
After dropping Sales Date into the Rows. This is what I get:
Is there any way to populate it like this? Please help, I am still new to tableau. Special thanks to Fabio Fantoni for the first solution!
Desired Format:
I have another sample data (refer to sample data 2) which I would like to populate in the desired format (refer to desired format 2). In Sample Data 2, the purchase date "15/12/2020" is not reflected in sold dates.
My apologies but I may require some guidance as I am still new to tableau. Thank you in advance.
Sample Data 2:
Desired Format 2:
Based on this sample:
In order to bypass your double count for two different date columns, you may want to cross join your original data with a copy of it on original.Purchase = support.Sold, like this:
Doing so, you just have to create two calculated fields:
count Purchase:
count([Purchase Date])
count Sold:
Count([Purchase Date (Foglio11)])
The only thing you have to pay attention to is that in the second calculus you have to count Purchase date due to your "inverted" cross join.
You should get something like this:

Tableau Fixed Calculation Summing too much data

I have volume data for specific customers. The customer names come from salesforce and the volume comes from another table. When I add each in tableau, i get a nice table that seems to be working.
We can see that there are 19 values ~500 My ultimate goal is to sum these based upon filters.
A way i discovered that i can do that is to use the syntax
{ FIXED [Account Id]: count([Volume]) }
But when i do that,
I get
When I change my function to count([volume]) i get a count of all joined rows ~250k
My question is how do i make this respect indivudal entries in the database and not all the joined values? If there was a way to do the sum for distinct timestamps in another field this would also work? Any other advice would be helpful from you tableau experts.
Thanks!
I think i got it. In the table of the database that i was trying to calculate there were 20 rows that needed to be calculated. When the data was joined in SF, it duplicated the rows. The trick here was to do the sum of the max for each primary key
SUM({ FIXED [Pk], [Name1] : MAX([Volume]) })

How to analyze/group by text in power bi

I'm quite new to power bi and wonder how to analyze interests of persons over time.
My table looks like:
User, InterestedIn, Date
UserA, Sports, 2018-10-02
UserB, Sports, 2018-10-05
UserC, Reading, 2018-10-05
UserC, Math, 2018-11-03
....
I know want to make visualisations about how the interests develop over a period of time. I therefore related the date column to my date table, but when i drag the "InterestedIn" and Date Column into a visual im not able to generate a meaningfull output.
Do i have to add like a "Count"-Column with numeric values?
Thanks in advance for your help!
Best practice would be to use the Modeling ribbon to add a Count measure e.g.
# Interests = COUNTROWS ( Interests )
and/or
# Users = DISTINCTCOUNT ( Interests[User] )
Then add that to Values well or similar (depends on which visuals you want).

How can I sum up values by date(month) in report builder 3.0 graphs?

I'm trying to sum the data points by Months instead of individual days. The data is originating from an SQL Query so I'm thinking this may be the only way to do that. However, I would much rather do this inside of Report Builder 3.0. Any hints on how to do this?
For example, I want to see the number of tickets for the Months of December and January as only two seperate data points.
can you create a new field ( calculated perhaps) onthe dataset and group by that?
else you should be able to create an expression on the graph's group that groups by Month of a certain field.