The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Sorry for maybe such a basic problem of mine, I'm currently in the learning curve but can't figure out DAX measure so simply yet.
I'v got data sample as following:
Would like to vizualize two gauges, actual vs. target values:
- latest non blank 'BOMValue' vs. respective 'BOMTargetValue' (for 'Detector' device only)
- same for 'Bridge' device only
In my mind, it shoud be solved by DAX codes, right? Something like:
Thanks for a million
Solved! Go to Solution.
sorry, tested on data that were to simplified, so it gave the correct answer for the wrong reason.
Can you try this code instead:
Last BOM Value =
CALCULATE (
SUM ( Data[BOM Value] ),
LASTNONBLANK ( 'Data'[Date], CALCULATE ( SUM ( Data[BOM Value] ) ) )
)
Idealy, 'Data'[Date] should reference a date/calendar table, so if you have one of those, replace this part of the code.
Hi @gerplus
writing your measures like this is sufficient:
Last BOM Value = LASTNONBLANK('Table'[Bom value];0)
and then add the field Detector/Bridge to the visual filter pane of each gauge, and set it to filter to equal to detector and bridge, respectively
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
thank you for help, now I understand the idea how to solve it, but this formula gives me errors and I don't know why:
The syntax for ';' is incorrect. (DAX(LASTNONBLANK(UnitTable[BOMValue];0)))
Never mind, I figured out the formula problem, it should have "," instead of ";"
Now I see values on gauge but the next problem is that formula is not giving value of last non blank (last date) but maximum value from column instead
sorry, tested on data that were to simplified, so it gave the correct answer for the wrong reason.
Can you try this code instead:
Last BOM Value =
CALCULATE (
SUM ( Data[BOM Value] ),
LASTNONBLANK ( 'Data'[Date], CALCULATE ( SUM ( Data[BOM Value] ) ) )
)
Idealy, 'Data'[Date] should reference a date/calendar table, so if you have one of those, replace this part of the code.
Thank you so much, you helped me to understand the logic how I should think in PBI!
User | Count |
---|---|
12 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
13 | |
9 | |
7 |