The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I wonder if someone can help me with the DAX for a Measure.
I have a target field in a Matrix that doesn't seem to be calculating correctly. See below
In the first level grouping the values are correct, but not in the top grouping or for the grand total.
The Target is a running total for the month grouped by Program, so should be the sum of all the Target values in the top level group and for the grand total.
The DAX I'm using is fairly simple. Uses 2 measures.
[TargetWholeNumber] = SUMX(DISTINCT(DimDate[MonthName]), FIRSTNONBLANK(MeasureData[Target], 0))
Any advise will be appreciated.
Cheers,
[TargetWholeNumber] = SUMX(DISTINCT(DimDate[MonthName]), FIRSTNONBLANK(MeasureData[Target], 0))
Using FIRSTNONBLANK you add only one value per month to the total. Thus, in the grand total rows, the total can only be the sum of one subcatrgory, not of all.
What about wrting
[TargetWholeNumber] = SUM(MeasureData[Target])
instead?
Thanks for your reply, but using the Sum won't work. The target amount is repeated for each measure values. Using a sum will multiple the target amount. I just need to find a way to sum up the group values and grand total amount.
What about setting a month filter on the visual in addition?
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |