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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Yuiitsu
Helper V
Helper V

Always return result from latest month regardless if there is any data

Hi All

 

I have this visual that show the outstanding USD invoice for current month. 

I have filter it such that it will always automatically show the latest report month. There isnt any issue until this month, because there is no outstanding for USD however it still shows a value.

Upon checking I realised because this month is blank for USD, it shows the outstanding for last month instead

Yuiitsu_1-1709523590406.png

 

Yuiitsu_2-1709523748535.png

Yuiitsu_3-1709523761286.png

 

Can anyone give me recommandation how can I resolve it? I want it to show as (blank) for USD because this month there should be no outstanding for USD.

1 ACCEPTED SOLUTION

Hi,

Thank you for your message.

I tried to recreate your sample like below.

Please check the below picture and the attached pbix file whether it suits your requirement.

 

Jihwan_Kim_1-1709701903577.png

 

 

Jihwan_Kim_0-1709701862603.png

 

Total balanced amount: = 
IF ( HASONEVALUE ( 'Currency'[Currency] ), SUM ( Data[Balanced Amount] ) )

 

Latest yearmonth amount: = 
VAR _latestyearmonth =
    LASTNONBLANK (
        'Calendar'[Year-Month sort],
        CALCULATE (
            SUM ( Data[Balanced Amount] ),
            REMOVEFILTERS ( 'Currency'[Currency] )
        )
    )
VAR _result =
    CALCULATE (
        [Total balanced amount:],
        'Calendar'[Year-Month sort] = _latestyearmonth
    )
RETURN
    _result

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

8 REPLIES 8
Jihwan_Kim
Super User
Super User

Hi, I am not sure how your [Latest Report Month] looks like, but please try to write the measure that removes currency filter.

 

REMOVEFILTERS function (DAX) - DAX | Microsoft Learn

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi

 

My report month column are date column.

Yuiitsu_0-1709532754006.png

 

Sorry I dont understand why remove currency filter? I need the amount to show based on currency filter though...

Hi,

Thank you for your message.

I like to suggest inserting a measure into it, instead of inserting the column directly.

And, I think, a measure can be written with having REMOVEFILTERS DAX function.

Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi

Thank you for the quick reply.

But I dont understand what you mean by inserting a measure into it?

Is it possible for you to show me an example?

Hi,

Please share your sample pbix file, and then I can try to show step by step process.
Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Sorry I cannot upload pbix file here neither can I share box link as well because it is a company box account.

Is it good enough if i share a sample table?

Report MonthCustomer NameProductCurrTotal Balanced Amount
2024-02-27AAARubberJPY100000
2024-02-27AAARubberJPY355554
2024-01-20AAAGearJPY178187
2024-01-20AAAWasherUSD378037
2024-01-20AAAWheelUSD3900
2024-01-20AAAWheelJPY192651
2023-12-15AAAGearJPY223500
2023-12-15AAAWheelJPY29000
2023-12-15AAAWasherUSD324000
2024-02-27BBBWheelJPY227424
2024-02-27BBBWasherUSD1404288
2024-02-27BBBNicJPY3661600
2024-02-27BBBRubberSGD3900
2024-01-20BBBGearJPY600
2024-01-20BBBRubberUSD1200
2024-01-20BBBRubberJPY3600
2024-01-20BBBGearSGD2700
2023-12-15BBBNicJPY25400
2023-12-15BBBGearSGD10800
2023-12-15BBBWasherUSD162000

 

Yuiitsu_0-1709616437776.png

Here is a sample of how the visual looks like.

So by default it should always show the latest month's value (in this sample it would be February 24), if that month has no value for that currency, it should show blank.

But there should be a date slicer at the side in the event user wish to see other older months.

Also there should be a customer slicer too.

Yuiitsu_1-1709616519484.png

 

Hi,

Thank you for your message.

I tried to recreate your sample like below.

Please check the below picture and the attached pbix file whether it suits your requirement.

 

Jihwan_Kim_1-1709701903577.png

 

 

Jihwan_Kim_0-1709701862603.png

 

Total balanced amount: = 
IF ( HASONEVALUE ( 'Currency'[Currency] ), SUM ( Data[Balanced Amount] ) )

 

Latest yearmonth amount: = 
VAR _latestyearmonth =
    LASTNONBLANK (
        'Calendar'[Year-Month sort],
        CALCULATE (
            SUM ( Data[Balanced Amount] ),
            REMOVEFILTERS ( 'Currency'[Currency] )
        )
    )
VAR _result =
    CALCULATE (
        [Total balanced amount:],
        'Calendar'[Year-Month sort] = _latestyearmonth
    )
RETURN
    _result

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Thank you!

 

Did a few random checks and it seems to run nicely!

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors