I have a table called CustTrans, with the following columns:
VOUCHER , TRANSDATE , AMOUNT , RECID , CUSTOMERID , DUEDATE
When an invoice is issued or payment is posted, a new line is created.
The connection between invoice and payment is created in a separate table called CustSettlement. In this table you can find SETTLEDAMOUNT with the TRANSDATE for settlement, and a TRANSRECID which is the same as the RECID of the voucher that has been settled.
I have created two measures to get Total Account Receivables today and over time:
Total Account Receivables = SUM(CustTrans[Amount])
And a measure to get Accrued Account Receivables over time:
Accrued AR = CALCULATE([Total Account Receivables], FILTER(ALL(Dates[DATE]), Dates[DATE]<=MAX(Dates[DATE])))
With the last measure I can see the development over time.
I have created a new table to get all dates: Dates = CALENDAR(MINA(CustTrans[TRANSDATE]), MAXA(CustTrans[TRANSDATE]))
What I am struggling with now is to determine the following:
Overdue amount 1-14 days, overdue amount 15-28 days and overdue amount over 28 days.
I can show the situation today by calculated column:
AMOUNTREMAINDER = AMOUNT - SETTLEDAMOUNT with RECID=TRANSRECID and determining the overdue status for every transaction with remaining amount.
However, I also need to show the development over time for each of the three categories, and I am struggling to combine the TRANSDATE in CustTrans and the TRANSDATE in CustSettlement to create an accrued measure.
Please let me know if I need to submit additional information.
Related
I have customer log which tells me when he salesperson change in tthe customer.
I have to count the customer per sales per month using this log.
Data
IDLog,IDCustomer,Date,IDSalesPerson
1,2576,2015-09-01,160
2,2572,2016-07-09,160
3,2576,2016-20-24,97
4,2572,2017-03-13,160
5,2576,2017-03-27,96
6,2621,2021-06-30,861
7,2621,2021-12-16,348
8,2576,2022-06-08,933
The result is something like that
tldr: I have two tables linked with two relationships, how do I calculate using both?
Hi, I am building a report on a fictional phone company. The data is stored in mongodb with the following format
User Account {
_id : unique account ID
other account details : [...]
yearly records : Array [ Yearly Record]
}
Yearly Record {
year num : ex 2022
monthly records : Array [Monthly Record]
}
Monthly Record {
month num : ex 5 for may
purchased minutes : minutes purchased this month
daily records : Array [Daily Record]
}
Daily Record {
date : date
consumed minutes : minutes used today
}
In this scenario, the minutes do not expire, each month you choose the amount you want to top up. The tables of interest are the monthly and daily tables. PowerBI fuses all user accounts in a single table. I'll omit some things but it looks like:
Monthly Records
_id purchased minutes monthly records idx yearly records idx
account id 100 position in monthly record array same principle
-----------------------------------------------
Daily Records
_id used minutes date daily records idx monthly records idx yearly records idx
account id 5 2022-10-31 ... ... ...
All tables are linked using _id in the modeling. For daily and monthly, the active relationship is the month idx. But since the tables are in the db, the month idx repeat so the relationship is many to many.
I havent found a way to filter out only the monthly details for only one user. SO if I were to put id and monthly purchase in a table, each user contains the reords of all users (see below)
Monthly Records
_id purchased minutes monthly records idx yearly records idx
1 100 0 0
2 200 0 0
Table:
id year month purchased min
1 2022 jan 100
1 2022 jan 200
2 2022 jan 100
2 2022 jan 200
The right months line up but the records are treated as duplicates (so if in feb 1 bought 300, we'd see feb 300 for both 1 anbd 2). I would almost need two active relationships on both the month idx and the id
How do I create a measure that is affected by both relationships? For instance if I chose id =1 and year + month = jan 2022 in slicers I should get only 100
Is this even possible in dax? I tried playing around with filter by id to no avail. In python there would be ways but then we deal with script visuals
My end goal is graphing minutes balance over time with
measure = bought - consumed
we'd see spikes at beginnings of month and the nline slowly go down as muinutes are used
I know you cannot outright define two active relationships but are there ways to deal with data as such?
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.
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!
I am trying to create a card that shows the most recent invoice above $1Million. Right now, I have a card that shows the most recent invoice, but I cannot find a way to only display the most recent above $1million.
Most Recent Invoice = CALCULATE(max(table1[Invoice_Line_Amount_USD]), lastdate(table1[Invoice_Posting_Date]))
EDIT: let me rephrase my question(s)/
I am wanting to show a table that has today's invoice only displayed and everyday when it is refreshed it will either show the invoices that were posted that day only or it will be blank (no invoices posted). I am wanting to have a card that shows the current days highest invoice about $1million and another card that shows the sum of the number of invoices for the current day. Then, I am going to create an alert that will notify me when an invoice about $1million is posted. The reason why I would like to display the highest invoice for that day on one of the cards is because when I receive that email it will tell me the amount of the highest invoice for that day (before I only had the sum of all of the invoices, which sent me an alert with only that amount).
Try this
Most Recent Invoice GTE 1M USD = CALCULATE(
lastdate(table1[Invoice_Posting_Date])
,
Filter( table1, table1[Invoice_Line_Amount_USD] >= 1000000)
)
If lastdate is not working correctly, try
Max ( table1[Invoice_Posting_Date])
The formula I did was filter the table for our conditions, which is >= 1M and the use the data to get the last date.
I reworked and did it two ways
Let us say you have data as Table with Data
I created measures and calculated columns as Table Columns
Is Today = IF(Table1[Invoice_Posting_Date] = TODAY (), 1, 0 )
Invoice Line Amount USD - Today = CALCULATE( SUM(Table1[Invoice_Line_Amount_USD]), FILTER(Table1, [Is Today] = 1 ))
Count Is Today GTE 1M = SUM( Table1[Is Today] )
Count Is Today = COUNTROWS( FILTER(Table1, [Is Today] = 1 ))
Overall output as
Overall output
using filters plus required measure approach