Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I don't know the best way to describe what I'm asking for but here it goes.
I have some data that has Account Numbers, Dates, Amounts, and a few attributes that classify the data like categories and types.
I've built a matrix in Power BI that shows the Categories, sub-categories, Category Detail and then SUM's the accounts based on the groups they fall into by Month/Year. This is basically a balance sheet.
I have everything working the way it should except one piece.
The retained earnings is calculated in the business application with a set date (Current Year -1). It then goes and sums up the retained earnings based on a few different pieces of data in the database. Here is the basic logic that I built in SQL and works great for a specific time period.
When the period is less than 201901 and the Type is less than 4
OR
When the Type is greater than 4 and the period is greater than or equal to 201900
AND
The period is less than the current period (IE 202005)
AND the ATTRIBUTE2 is N
AND the Account is equal to 3500
Then give me the SUM of the Amount.
If you wanted to see the retained earnings for 2018 you would simply change the dates.
My issue: Everything else in Power BI is dynamic so the user can go back to 2018 or 2000 or 1993 and see the balance sheet as it was at that time with the exception of this one calculation because its not dynamic. I know you can't pass parameters into Power BI from SQL so I cannot just build a view or sproc that passes in params.
The last catch to all of this is that you have to show a total at the bottom of the Matrix and one of the categories is retained earnings.
Basically in my mind I have to build a DAX expression that does the calculation I have unless it's account 3500 (retained earnings) then it would need to do this other calculation, and show it all inside of one Matrix and also show the proper total at the bottom of the page.
I cannot for the life of me figure out how I would accomplish this in DAX, any help would be greatly appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.