Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello all,
I have the below but as you can guess my totals don't agree as my matrix is per shop and per year.
Solved! Go to Solution.
VAR PreviousYearDates = PREVIOUSYEAR ( 'Dim Dates'[Date] )
VAR calc =
CALCULATE (
DISTINCTCOUNT( 'Fact Sales'[customer_id] ),
LEFT ( 'Fact Sales'[Shop_Code],1 ) = "S",
PreviousYearDates,
KEEPFILTERS (
NOT (
ISBLANK ( 'Fact Sales'[Shop] )
)
)
)
VAR TotalCalc =
CALCULATE (
DISTINCTCOUNT( 'Fact Sales'[customer_id] ),
LEFT ( 'Fact Sales'[Shop_Code],1 ) = "S",
PreviousYearDates
)
RETURN
IF (
HASONEVALUE('Dim Shop'[Shop]) && HASONEVALUE('Dim Dates'[Year]),
calc,
TotalCalc
)
VAR PreviousYearDates = PREVIOUSYEAR ( 'Dim Dates'[Date] )
VAR calc =
CALCULATE (
DISTINCTCOUNT( 'Fact Sales'[customer_id] ),
LEFT ( 'Fact Sales'[Shop_Code],1 ) = "S",
PreviousYearDates,
KEEPFILTERS (
NOT (
ISBLANK ( 'Fact Sales'[Shop] )
)
)
)
VAR TotalCalc =
CALCULATE (
DISTINCTCOUNT( 'Fact Sales'[customer_id] ),
LEFT ( 'Fact Sales'[Shop_Code],1 ) = "S",
PreviousYearDates
)
RETURN
IF (
HASONEVALUE('Dim Shop'[Shop]) && HASONEVALUE('Dim Dates'[Year]),
calc,
TotalCalc
)
I tried the above with sumx but doesn't work.
Please see this article for how to get your expected totals.
(2) Power BI - Tales from the front #01 - Getting the Right Total - YouTube
Pat
User | Count |
---|---|
81 | |
75 | |
70 | |
42 | |
36 |
User | Count |
---|---|
114 | |
56 | |
52 | |
43 | |
42 |