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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Experiment626
Frequent Visitor

Measure works fine in desk top not working when published

I have a measure to get the previous selected value so variance can be done Year over Year or Month over Month
based on slicer selection. It works fine in the desktop, but not when published. Any ideas?
 
PS Load Count =
VAR _CurrentYearMonth = SELECTEDVALUE('Calendar'[Year_Month_Index])
VAR _PreviousYearMonth =
    CALCULATE(
        MAX('Calendar'[Year_Month_Index]),
        ALLSELECTED('Calendar'),
        KEEPFILTERS('Calendar'[Year_Month_Index]<_CurrentYearMonth)
    )
VAR _Result =
    CALCULATE(
        [Load Count],
        All ('Calendar'),
        'Calendar'[Year_Month_Index] = _PreviousYearMonth
    )
RETURN
    _Result
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi, @Experiment626 

I am glad to help you.

 

The two environments, Power BI Desktop and Power BI Service, may differ in the way they handle filters and contexts.


Perhaps you could try replacing AllSelected with All in the Measure formula to see if that solves the problem.

VAR _PreviousYearMonth =
    CALCULATE(
        MAX('Calendar'[Year_Month_Index]),
        ALL('Calendar'),
        KEEPFILTERS('Calendar'[Year_Month_Index] < _CurrentYearMonth)
    )


Also you can try deleting Measure and recreating it to see if that solves your problem.

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

That did it.  Many thanks!

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi, @Experiment626 

I am glad to help you.

 

The two environments, Power BI Desktop and Power BI Service, may differ in the way they handle filters and contexts.


Perhaps you could try replacing AllSelected with All in the Measure formula to see if that solves the problem.

VAR _PreviousYearMonth =
    CALCULATE(
        MAX('Calendar'[Year_Month_Index]),
        ALL('Calendar'),
        KEEPFILTERS('Calendar'[Year_Month_Index] < _CurrentYearMonth)
    )


Also you can try deleting Measure and recreating it to see if that solves your problem.

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

That did it.  Many thanks!

Greg_Deckler
Super User
Super User

@Experiment626 What is the underlying storage mode? Import, DirectQuery, Live?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Imported

The Measure just doesnt work top from web bottom desktop

Experiment626_0-1730143279616.png

Experiment626_1-1730143385680.png

 

 

@Experiment626 OK, that rules out any issue with a gateway and such. So, when you say "not working" what do you mean by that? You get different values or you get an error or you get blanks? Have you tried resetting your report to the default in the Service ( it's a circular icon in on the far right of the ribbon ).



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Experiment626_0-1730202255483.png

 

Yes

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

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

Top Solution Authors