Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hey, everyone!
It seems to be simple, but somehow I can't get through it! So, I hope you can kindly help me 🙂
I have a table in Excel which I'd like reproduce in PBI:
Basically, I have to sum my values until this date in the table header (it's the day I get the data) and show the sum value in this day.
In PowerBI, all I could do so far was the following table with the measure:
The following measure gives me the same exact result showed above:
I use a table containing a single column with the dates I downloaded the repport, so I don't really rely on a calendar table (I know it is a sin)
I do know I'm missing some FILTER function here, I've tried so many things and it didn't work (even CLOSINGBALANCEMONTH, which I don't really think it applies here)
I was so easy on Excel, I could just use SUMIF and then compare to any date reference, but I can't do it in PBI.
Any insights?
Thank you all in advance 🙂
Hi @lauramatosv ,
Please try this.
.#IncomeByMonth =
VAR x =
CALCULATE(
SUM(Received[VALREC]),
FILTER(
ALL('Report date'[date]),
'Report date'[date]<=MAX('Report date'[date])
)
)
RETURN
CALCULATE(
x,
FILTER(
'Chart Account',
'Chart Account'[Income]="Sim"
),
FILTER(
'Report',
'Report'[Year]=2020
)
)
If it's invalid, please provide a sample file of .pbix, I need to determine the filter context in the formula according to the data model.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can try this. The MAX value you were using was calculating each time. I moved it to a variable, which is equivalent to wrapping in EARLIER, but a better practice.
IncomeByMonth =
VAR varReportDate =
MAX( 'Report date'[date] )
RETURN
CALCULATE(
SUM( Received[VALREC] ),
'Chart Account'[Income] = "Sim",
'Report'[Year] = 2020,
FILTER(
ALL( 'Report date'[date] ),
'Report date'[date] <= varReportDate
)
)
But to really help, we need data we can use. Cannot use screenshots for data. Help us help you.
How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingHow do you define the cutoff date?
A simple way of doing this is to use a measure along the lines of:
Cutoff =
VAR CutOffDate = [whatever expression you use to define the cutoff date]
RETURN
IF(SELECETEDVALUE('Report date'[date]) > CutOffDate, BLANK(), [Your measure])
Proud to be a Super User!
Paul on Linkedin.
User | Count |
---|---|
128 | |
109 | |
100 | |
65 | |
62 |
User | Count |
---|---|
137 | |
115 | |
102 | |
71 | |
61 |