Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi there!
Perhaps a newbie question, but I can't wrap my head around how a measure reacts to filters...
I have a measure that calculates sum of sales for the most recent day in the data :
So far, so good.
However, if I create another visual showing Invoices_LQ[PostDate_DateFormat] and I select a value in there, sometimes it changes my Max Day Sales measure :
On top of that, it only seems to do so for certain Invoices_LQ[PostDate_DateFormat] only, and I haven't been able to identify some sort of pattern.
I'm guessing it has to do with some sort of context filtering I'm not understanding.
Still fairly new to PowerBI but this has given me a pretty bad headache!!
Anyone has a clue?
Thanks a lot!!
Solved! Go to Solution.
@paulpassot
Aparently this is Auto-Exist problem.
First step try to manually calculate the last day sales. If it does not match the result of my first solution then you need to have a date table that filters your data set. This will totally eleiminate the problem.
Hi @paulpassot
please try
Max Day Sales =
VAR MaxDate =
CALCULATE ( MAX ( Invoices_LQ[PostDate_DateFormat] ), REMOVEFILTERS () )
RETURN
CALCULATE (
SUM ( Invoices_LQ[InvoiceLine.Amount] ),
Invoices_LQ[PostDate_DateFormat] = MaxDate,
REMOVEFILTERS ()
)
Hi, thanks for the quick reply!
Interestingly, it gives the same result across dates (which is good), but it doesn't seem to give the right number:
I would expect 4,744$, not 5,358$.
I understand the logic of your code though, and I can't figure out how it comes up to 5,358$
@paulpassot
I don't know how your data looks like but seems to me there are other filters. You may try **bleep** this way
Max Day Sales =
VAR MaxDate =
CALCULATE (
MAX ( Invoices_LQ[PostDate_DateFormat] ),
ALL ( Invoices_LQ[PostDate_DateFormat] )
)
RETURN
CALCULATE (
SUM ( Invoices_LQ[InvoiceLine.Amount] ),
Invoices_LQ[PostDate_DateFormat] = MaxDate,
ALL ( Invoices_LQ[PostDate_DateFormat] )
)
So strange... it gives me the same result as my initial formula. Randomly giving a different number depending on what I select in another visual:
Here it is ok, filtered on 21st of june
Here it gives me a different value (wrong) when filtered on the 20th of june:
My datamodel is incredibly simple: single table with sales transactions in rows, a column for price and a column for date. I made a calculated column that "rounds" the post date (which is datetime) to a regular date :
@paulpassot
Aparently this is Auto-Exist problem.
First step try to manually calculate the last day sales. If it does not match the result of my first solution then you need to have a date table that filters your data set. This will totally eleiminate the problem.
@paulpassot , Try like
Max Day Sales =
CALCULATE(
SUM( Invoices_LQ[InvoiceLine.Amount] ),
lastdate(Invoices_LQ[PostDate_DateFormat] )
)
for date
MAxx(ALL( Invoices_LQ[PostDate_DateFormat] ), Invoices_LQ[PostDate_DateFormat] )
Unfortunately it doesn't work, it gives me the values for each date:
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 11 | |
| 5 | |
| 5 |