March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello everyone!
I am creating this measure that works as needed only if I keep the date fixed like DATE(2024, 6, 10), if I try to make the date dynamic using a measure that returns the greatest date chosen by the user in the calendar like this:
maxx(dCalendar,[Date])
I get the error "unexpected exception"
SUMX(
ADDCOLUMNS(
SUMMARIZE(
FILTER(
fStock,
fStock[DTABASE] <= DATE(2024, 6, 10)
),
fStock[PRODUCT_CODE],
fStock[BRANCH],
"MaxDate", MAX(fStock[DTABASE])
),
"Cost",
CALCULATE(
MAX(fStock[COST]),
FILTER(
fStock,
fStock[DTABASE] = [MaxDtaEntradaSaida] &&
fStock[PRODUCT_CODE] = EARLIER(fStock[PRODUCT_CODE]) &&
fStock[BRANCH] = EARLIER(fStock[BRANCH])
)
)
),
[Cost]
)
@Jean_Ferro What about just MAX('dCalendar'[Date])
or:
Measure =
VAR __Date = MAX('dCalendar'[Date])
VAR __Result =
SUMX(
ADDCOLUMNS(
SUMMARIZE(
FILTER(
fStock,
fStock[DTABASE] <= __Date
),
fStock[PRODUCT_CODE],
fStock[BRANCH],
"MaxDate", MAX(fStock[DTABASE])
),
"Cost",
CALCULATE(
MAX(fStock[COST]),
FILTER(
fStock,
fStock[DTABASE] = [MaxDtaEntradaSaida] &&
fStock[PRODUCT_CODE] = EARLIER(fStock[PRODUCT_CODE]) &&
fStock[BRANCH] = EARLIER(fStock[BRANCH])
)
)
),
[Cost]
)
RETURN
__Result
Unfortunately the same unexpected exception error, if I change it to DATE(2024,6,5) for example it works, but I need it to be dynamic.
The measure to return the greatest date seems correct to me:
@Jean_Ferro Any chance you can post a link to the file? Otherwise it's really hard to understand what is going on here.
I was preparing a file to upload with just the information to reproduce the error but when I tested it on this test file it worked.
In my production development I use two databases communicating by direct query sharing 1 calendar, when I separated the calendars leaving one for each database it worked.
I'm going to use it like this for now, but I would like to find a way to use a calendar for both databases without the error.
@Jean_Ferro You may want to play around with privacy level settings then. Depending on those settings, some cross query/source queries aren't allowed.
With this method, i change privacy level for this on all file involved:
Is here?
Still dosent work.
Only works on this way:
@Jean_Ferro Yep, that's what I was referring to. Interesting, let me do some research as maybe there is some kind of formula firewall thing going on here.
I tried this way too and it still doesn't work.
I really appreciate your attention and help, I will continue working in the way it is working, if you have any more ideas I would be very happy if you shared them!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
12 | |
9 | |
7 |
User | Count |
---|---|
38 | |
32 | |
29 | |
12 | |
11 |