Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
glamanna
Frequent Visitor

Value on matrix drill-down, shown before selecting the drill down option.

Hi everybody, Im creating a matrix in PowerBi that displays various data. One of those is the "aging" of a certain item, so it will be displayed on the last day of the month.
The issue I'm facing is that the value will not be shown unless I drill down to "DAY"via Date Hierarchy (Month, Day), but I need it to be displayed also when showing the month. 
Can anyone help me solve this?
-----------------------------------------------------

AGING average eomonth =
IF(
    SELECTEDVALUE('Foglio1'[eomonth]) = 1,
DIVIDE(
    SUM(Foglio1[Aging]),
    SUM(Foglio1[Giacenza]),
    BLANK()),
    BLANK())
----------------------------------------------------
eomonth =
VAR currentMonth =
    MONTH('Foglio1'[Data])

VAR latestDateofMonth =
    CALCULATE(
        MAX('Foglio1'[Data]),
        FILTER(ALL('Foglio1'), MONTH('Foglio1'[Data])=currentMonth && 'Foglio1'[Giacenza] <> BLANK())
    )
RETURN
    IF('Foglio1'[Data] =latestDateofMonth, 1, 0)

----------------------------------------------------
Matrice EOMONTH.PNG

2 REPLIES 2
v-jianpeng-msft
Community Support
Community Support

Thank you for your solution  @johnbasha33 
Hi,  @glamanna 

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

 

Best Regards

Jianpeng Li

johnbasha33
Impactful Individual
Impactful Individual

@glamanna 

It seems like you're trying to calculate the aging of certain items on the last day of each month and display it in a matrix in Power BI. The issue you're facing is that the aging value is not shown unless you drill down to the "DAY" level via Date Hierarchy (Month, Day), but you need it to be displayed even when showing the month.

To address this issue, you can modify your DAX measures to ensure that the aging value is calculated correctly at both the month and day levels. Here's how you can modify your measures:

1. **AGING average eomonth**:
```DAX
AGING average eomonth =
VAR CurrentMonth = MONTH('Foglio1'[Data])
VAR LatestDateOfMonth =
CALCULATE(
MAX('Foglio1'[Data]),
FILTER(ALL('Foglio1'), MONTH('Foglio1'[Data]) = CurrentMonth && 'Foglio1'[Giacenza] <> BLANK())
)
RETURN
IF('Foglio1'[eomonth] = 1,
DIVIDE(
CALCULATE(
SUM('Foglio1'[Aging]),
'Foglio1'[Data] = LatestDateOfMonth
),
CALCULATE(
SUM('Foglio1'[Giacenza]),
'Foglio1'[Data] = LatestDateOfMonth
),
BLANK()
),
BLANK()
)
```

2. **eomonth**:
```DAX
eomonth =
VAR CurrentMonth = MONTH('Foglio1'[Data])
VAR LatestDateOfMonth =
CALCULATE(
MAX('Foglio1'[Data]),
FILTER(ALL('Foglio1'), MONTH('Foglio1'[Data]) = CurrentMonth && 'Foglio1'[Giacenza] <> BLANK())
)
RETURN
IF('Foglio1'[Data] = LatestDateOfMonth, 1, 0)
```

Make sure to replace `'Foglio1'` with the actual name of your table.

With these modifications, your measures should correctly calculate the aging values for the last day of each month and display them in the matrix even when not drilling down to the "DAY" level.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.