How to use calculate and distinct count together in powerpivot - excel

I want to count the following in powerpivot.
I have a column with customer numbers and then I have another column with status ("paid", "no")
If any of the customer entries are "paid" I want that to count as 1 unique customer. If not, then there is no count.
For example, 1,1,1 and "paid" "paid" "paid" would be equivalent to 1 count.
I tried this
Copy of Calculated Field 1:=CALCULATE(Count(Table1[Claim]),Table1[Invoice]="Paid")
but it essentially counted ALL instances of "Paid".

Are you not just looking for a distinct count?
=CALCULATE(DISTINCTCOUNT('Table1'[Customer_ID]),'Table1'[Invoice]="Paid")

Related

How to count the number repeated product purchased by the same customer based on

I have a table with
customer identifier (email)
order number (1 refers to the first order one has placed, 2 is the 2nd)
SKU is the product identifier.
I want to see a table that has two columns:
SKU
the number of times this product has been showed in both the 1st and 2nd order of the same customer. Or in other words, how many times the product has been ordered repeatedly.
Something like this:
What excel function could achieve this?
You can achieve this with a helper column using COUNTIFS, and then a pivot table:
Helper column formula:
=--(COUNTIFS(A$2:A2,A2,C$2:C2,C2)>1)
Add a value filter to the pivot table to only show rows with a value greater than 0.
You can also create a Power Pivot table to count distinct orders and create a measure to count repeat orders.
Here, column F is the Distinct count of customer and column G is the total count of customer for each SKU. Columns H and I are measures you can create with power pivot.

How to change value of field based on values of two other fields in Excel or Google Sheets

I'm trying to create a customized personal expense report on Google sheets . If anyone has suggestions for a better approach, I'm open to to ideas!
In one column Category, I have option to select category with a drop down - Restaurants, Rent, Electricity etc. The column Value on the next to it holds the an integer value.
On a the same sheet, I have a column where all categories are defined. In the column Limit next to it, is the maximum integer value for each category. The next column Balance holds the remaining value (Limit - Sum of all Value matching Category)
My question is - when I add an entry in sheet 1 for any category with a value, how do I subtract the Value added from the respective Category to show the remaining balance from Limit in Balance column? As I keep adding items, the Balance field should get updated.
TABLE 1
Item Category Value
i1 Rest 100
i2 Rent 50
..
..
TABLE 2 (In same sheet somewhere adjacent to the above table)
Category Limit Balance
Rest 500 400
Rent 1000 950
..
..
Try using this:
=IFNA([limitcellname]-SUMIF([rangeofcategories],[categorycellname],[expensevaluerange]),[limitcellname])
Range of categories = column where all categories are listed in the expenses table. E.g- B:B if B column has expense categories
expense value range = column where all expenses are listed in the expenses table. E.g- C:C if expenses values are in C column
category cell name is the category cell in the balance table
limit cell name is the limit cell
This should work for your purposes

How to skip counting same value set in 2 columns that appears in another 2 columns set

Good day, I need some help on how to form an Excel formula to count distinct for values in 2 columns with other columns:
I want to count a number of subjects assigned to "ummu", but that same subject name appears again shouldn't be count. In this example, the count will return 4. How can I achieve this using excel formula?

How to calculate with reference id

I have a workbook in which there is stock detail on sheet 1 and sales detail on sheet 2.
I want to auto-calculate the remaining stock. But the sales inventory is based on dates so all the different products are mixed up. Every product has a unique ID. So how I can subtract the sale product from stock based on their IDs?
An example:
The customer comes and buy 4 shirts.
I enter the product with product ID, and in the Qty column I added 4.
Now I want to minus 4 from actual stock.
How it can be done in Excel?
You need to take the sum of all sold products in sheet 2 based on condition that productID in sheet2 equals our interesting product in sheet1. Use:
=SUMIFS(B2:B100,A2:A100,productID)
where column A contains product IDs and column B contains "sold" values.
Then subtract that sum from the stock total in sheet1, e.g:
=B3-(SUMIFS(Sheet2!B1:B100;Sheet2!A1:A100;A3))
where column A contains product IDs and column B includes stock totals.
(note how "productID" from the first expression is here replaced with "A3", i.e. the value of productID column for the current row).
Copying this last formula to other product rows should automatically update the relevant values.

COUNTIF Unique values

I used this formula to find SKU counts in certain categories given multiple criteria:
=+COUNTIFS(Data!$AG:$AG, ">"&0,Data!$AO:$AO, "="&$A115,Data!$L:$L, "="&D$104,Data!$P:$P,$B$103)
I am able to find the SKU counts but it gives me the total SKU count, I believe because it now counts any SKU with inventory greater than 0 with my multiple criteria.
How can I change the formula to get the unique SKU count per division?
Column AG: Inventory
Column AO: Division Name
Column L: Month
Column P: Year
Column T: SKU Code(written out) - what I need to find unique values of.
Example here: dropbox.com/s/hxbt7hb9l8hf4w6/Sample%20Example.xlsx?dl=0
If you created a helper column on the input sheet with the formula (e.g. in BG2):
=1/COUNTIFS(T:T,T2,AG:AG,">0",AO:AO,AO2,L:L,L2,P:P,P2)
This means that if you had, for example, 5 times the SKU in one Division/Month/Year, you would get 1/5. Then, in the calculation sheet, replace your COUNTIFS with a SUMIFS (summing your new helper column, using same conditions). This will mean that your 5 duplicates (with 1/5 in the helper) get summed to 1 - i.e. 1 unique SKU
EDIT
Because there are some where there is no positive inventory, the count gives you 0 and you get a #DIV/0! error... so we can fix that with:
=IFERROR(1/COUNTIFS(T:T,T2,AG:AG,">0",AO:AO,AO2,L:L,L2,P:P,P2),0)
Then, in the Output-EOM Unique SKU Count sheet, in cell e.g. B6, use:
=SUMIFS(input!$BG:$BG,input!$AO:$AO,$A6,input!$L:$L,B$5,input!$P:$P,$B$4)

Resources