I have a sales fact table that contains customers ids and is linked to customers dimension table that contains all registered customers in the system with entry/ customer creation dates. Sales fact table has active relationship with Dates table by sales date.
How to write a measure that could give inactive customer count in selected period, accounting for customer creation date that does not have relation to Dates table?
i.e. Active customers - distinctcount of customer id in Sales fact table.
Inactive customers - countrows of customer id in Customer table, if customer id not present in Sales fact table and if the creation date-time of the customer in Customers table is < than the Max date of the selected period in Date table.
From visuals I will have cards displaying active, inactive customer count in selected period
+ matrix that should contain list of all customer names (active, inactive) with sales amounts by year-month. When selecting periods, matrix should contain only inactive customer names that were registered in the system before max date of selected period. It cannot display all customers from Customers dimension table. Is this possible?
Would highly appreciate your help!
Related
I have one question about DAX calculation?
Hi Guys,
I have one question about DAX Measure Calculation
Please Help me get the solution of this problem
I have 2 tables
table 1 - Purchase Info
(Column name - Customer ID, Product ID, Quantity, Payment Mode)
table 2 - Product Info
(Column name - Product ID, Product Name, Product Cost, Selling Cost, Tax Amount)
My Question Is, How to Calculate Total Revenue?
The Table 1 (Purchase Info) have repeated customers and more than 10 thousand of records and also records are shuffled. The table 2 (Product Info) have only 10 products and unique records ( Product ID). How to calculate the total revenue.
This will work if you linked your tables via Product ID.
SUMX(
Prod
,CALCULATE(SUMX(Sales,Sales[Quantity]))*Prod[Selling Cost]
)
I have following questions.
Table Sales:
Table Product:
Table Sales is connected to table Product via Sales ID.
Table Sales contain 5 unique records, table Product contain only 3 of them. 2 are missing. Is there some way how to artificially create in Power BI missing category?
Scenario: I have multiple columns in a table e.g. customer ID, customer Name, City, Invoice amount, paid amount.
I want to create a slicer based on invoice amount, where I can filter the data based on invoice amount column as below:
Amount 5000-200000 - Slicer Option should show text "Low"
Amount 200000 - 1000000 - Slicer Option should show text "Medium"
Amount 1000000 - any higher amount - Slicer Option should show "High"
I tried using Dax If ( or ( ... ) ) but it is not working.
Since I am new to Power BI so don't know if I should create a measure a column or a table.
Thanks in advance
You can create a "New Column" in the Table, using "Table tools":
Introduce this code:
AmountType = if(Table[Amount]>1000000,"High",if(Table[Amount]<200000,"Low","Medium"))
Then use AmountType in the slicer.
Note that if you need to exclude those with Amount < 5000 from the category "Low" you would have to add it to the if statement:
if(AND(Sheet1[Amount]<200000,Sheet1[Amount]>100000),"Medium","Low")
I have two tables which have counts and sales based on dates and one of them also have customer ID. The counts are not same when we see by customer and summary. I also have customer filter on my dashboard. What I want to achieve is if no customer is selected the count should come from summary table otherwise it should come from customer if multiple or one is selected in the filter.
Customer Table
Summary Table
Any hints, I have tried lookupvalue function but I cant put date as search value from date table.
It's much easier to use Measures, instead of creating calculated tables to obtain those metrics. Also, summarized tables would not have the same filter context your are looking for.
Measure 1
Total Customers =
DISTINCTCOUNT('Customer Table'[CustomerID])
Measure 2
Total Sales =
SUM ( 'Customer Table'[Sales])
I have a Power BI/DAX question. I'm looking to summarize my data by getting monthly transaction sums (including the year as well, i.e. MM/YY) and filtering them by individual account numbers. Here is an example:
I want to take that and make it into this:
I converted the dates to the format I want with this code:
Transaction Month = MONTH(Table[Date]) & "/" & YEAR(Table[Date])
Then got the total monthly sum:
Total Monthly Sum = CALCULATE(sum(Table[Transaction Amount]),ALLEXCEPT(Table, Table[Transaction Month]))
Now I'm trying to figure out how to filter the total monthly sum by individual account numbers. Just as a note - I need this to be a calculated column as well because I'll want to identify accounts that surpass individual account monthly spending limits. Can anyone help me with this?
Thanks so much!
When working with calendar dates, it pays to have a calendar table linked to the transaction table. In the calendar table you will have each date, from the start date of your relevant time period to the end of the time period relevant to your data. The columns of the calendar table can then contain calculations on that date like month number, month name, year, year-month key, transaction month (as the first day of the month for the date in that row), etc.
Next, connect the two tables in the data model by dragging the transaction date to the calendar date column.
Now you can build charts and report tables that group data by month without writing any complicated DAX. Just pull the field "transaction month" from the calendar table and the Total Sum measure from the transaction table into the field well of the visual.
That's what Power BI is all about.