I'm stuck in finding total sales of a day, I need to further find out the % of each product in a particular date.
for eg: sales of beverages for 2/17/2018
Here I am trying to find the total sales for one particular date :
I am expecting 922 in the salesperday column.
your table:
Transaction_Date
product_group
sales
SalesPerday
2/17/2018
Add-ons
$11.2
$11.2
2/17/2018
Beverages
$725.25
$725.25
2/17/2018
Food
$133.25
$133.25
2/17/2018
Merchandise
$24
$24
2/17/2018
Whole Bean/Teas
$28.95
$28.95
2/18/2018
Add-ons
$27.2
$27.2
2/18/2018
Beverages
$817.3
$817.3
2/18/2018
Food
$138
$138
2/18/2018
Merchandise
$54
$54
2/18/2018
Whole Bean/Teas
$178.18
$178.18
you need to add Calculated Columns for day with following formula:
Day = DAY('table'[Transaction_Date])
then you need SalePerDay measure
SalePerDay = CALCULATE(SUM('Table'[sales]),ALLEXCEPT('Table','Table'[Day]))
at last create following measure for calculate percentage of product category per day
%Sale = SUM('Table'[sales])/[SalePerDay]
just aware of implicit measure and don't use them.
Related
I'm new to Power BI and struggling a bit with concepts. My simplified problem is this:
I have a table with time-track data (possible multiple entries per day for the same user):
datetime
timeTracked (hours)
user
2022-12-01 14:15
1.5
john
2022-12-01 16:30
0.5
john
2022-12-02 12:00
2.5
tom
I also have second table with yearly wages for each user (irregular dates, wage is applicable from that day forward):
date
user
wage
2021-01-01
john
20000
2021-06-15
tom
25000
2022-02-01
john
22000
I want to somehow calculate the cost for a dynamic period or total time, but using other filters (like client).
For example: total cost for current month - the sum of hours for each user multiplied by hourly cost (let's say yearly wage / 1500 for simplicity). The complication is that there might be multiple applicable wages in the selected period.
I'm not sure if I should create a new table, new column(s) to existing table(s), measure(s) or anything else? I don't know how to deal with this problem in Power BI, any hints, links or examples are very appreciated!
I want to create measure Invoice Counter that shows number of invoices per customer. This measure must reflect slicer in the page.
If in year slicer is selected year = 2022, measure should reflex this.
Sorry I don't paste my test code here, it was nonsense so far.
Thanks for help.
Your modelling approach is a little awkward: Your table shows an Invoice Counter of 3 for the single invoice 11 in 2022 for "jack", and the sum of Invoice Counter is 14, although there are 6 different invoices only. This is at least confusing ...
Your Invoice counter measure should aggregate invoice like this:
Invoice Counter =
CALCULATE(
COUNT('Table'[invoice]),
ALLEXCEPT('Table', 'Table'[customer])
)
but then you can't filter it by invoice again, because that will undo the above aggregation. Just put customer, year and Invoice Counter in one table and of cause you can filter that table by year, if you like:
Objective:
Looking to generate a column measure (DYNAMIC BALANCE) which reads the first row of BALANCE, and calculate the balance from subsequent rows using AMOUNT column.
Problems encountered:
Measure should ignore the AMOUNT on the first row and only capture the BALANCE into a variable.
My first row formula grabs both values for 1/1/2021 rather than only the top most row balance value.
Date
Description
AMOUNT
BALANCE
1/1/2021
Dog Food
-20.00
980.00
1/1/2021
McDonalds
-30.00
950.00
1/5/2021
Pay Day
1000.00
1950.00
1/8/2021
Dog Food
-20.00
1930.00
1/10/2021
Medical
-1000.00
930.00
1/18/2021
McDonalds
-30.00
900.00
1/21/2021
Pay Day
1000.00
1900.00
1/31/2021
Dog Food
-50.00
1850.00
2/2/2021
McDonalds
-40.00
1810.00
You are my hero!
Here is the solution. Funny how the solution is so simple in DAX and in hindsight. M-Code would have been more complicated. DAX is dynamic to the filter which is necessary.
New Measure:
RunningTotal = FIRSTNONBLANK(bankdownload[Balance],0)+SUM(bankdownload[Amount])-FIRSTNONBLANK(bankdownload[Amount],0)
I am trying to calculate the Cumulative Purchases by YTD. The first step is to rank the items by Cost Amount, but when I try to rank by the [_YTD Cost] measure, the numbers I get do not make sense (skipped numbers, duplicated).
[]
I had 3 slicers: Month, Year and to select Month/YTD measures. Since with the Month calculation I have no problems, I removed the interaction with the Month/YTD slicer and I placed only YTD measures on the table:
Total Purchase Cost = SUM ( Purchases[Amount] )
_YTD Cost = TOTALYTD([Total Purchase Cost], 'dim-calendar'[Date])
_RANK YTD = RANKX(ALLSELECTED(Purchases), [_YTD Cost])
Notes:
I pulled the item from the Item table
The Purchase table is linked to the Date table by Purchase Date
Not 100 % sure on your data model, but try changing your RANKX(ALLSELECTED(***) to reference the Item-column. Like this:
RANKX(ALLSELECTED('Item'[Item]), [_YTD Cost])
i'm new in power bi and i need some help.
i need to calculate total sold product between two dates, e.g. from 5 Feb 2021 to 5 apr 2021, i cant find any solution.
Assume you have sales table with two column Date and Amount. Now you can create your measure as below-
total_sold =
CALCULATE(
SUM(sales[amount]),
DATESBETWEEN(
sales[date],
start_date,
end_date
)
)
Create a card or table and drag your no. of products sold column to the card, and use the filter on the date column to get the total no. of products sold in the time period.
Note:- Please be a little more specific and descriptive the next time.