Forum Discussion
Count running accruals
Hi all,
I am want to make a measure that counts the current running accruals of a company. Here's how the raw data would look like on the left, and I plan to arrange the data like this on the right:
From the arranged data, what should happen is that the measure will count the instances where an accrual is incurred from the most recent AfP period which is "10", and the measure will stop counting if the there is a 0 or blank encountered. If the value returned from the most recent period is zero or blank, the measure will not count or should return a value of 0. The expected result of the measure should be like this:
Any kind of help is appreciated. Thank you!
Hi Anonymous ,
Is that the excepted result you need?
Measure 3 = SUMX ( FILTER ( ALL ( Table2[Supplier] ), Table2[Supplier] <= MAX ( Table2[Supplier] ) ), [Measure 2] )
8 Replies
- v-frfei-msft
Community Support
Hi Anonymous ,
To create a measure as below.
Measure = VAR maxmonth = MAXX ( ALL ( Table1 ), Table1[Month] ) VAR maxmonth0 = CALCULATE ( MAX ( Table1[Month] ), FILTER ( ALL ( Table1 ), Table1[Cost] = 0 ), VALUES ( Table1[Supplier] ) ) VAR a = CALCULATE ( SUM ( Table1[Cost] ), FILTER ( Table1, Table1[Month] = maxmonth ) ) RETURN IF ( a = 0, 0, CALCULATE ( COUNT ( Table1[Cost] ), FILTER ( Table1, Table1[Month] > maxmonth0 && Table1[Month] <= maxmonth ) ) )- AnonymousNot applicable
Hi, I'll check this out tomorrow. Thanks for the help!
- AnonymousNot applicable
hi v-frfei-msft ,
What if I have multiple entries of cost for one period/month, what would I add into the measure? My actual raw data is like this:
The cost type is categorized into two types: Accrual and Actual. I've added a filter to consider only the Accrual cost and replaced the columns appropriate to my data, and when I inserted the measure, the result looked like this:
Thanks for the help
- v-frfei-msft
Community Support
Hi Anonymous ,
Could you please create a sample pbix to me? Please upload your files to One Drive and share the link here.