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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
gator99
Helper I
Helper I

Sum of a column (measures) issue

Sorry, couldn't find this by searching but I was curious, I have created several measures to caculate Month to Date numbers as well as Previous year MTD.

 

MTD Days Open = TOTALMTD(COUNT(vwBusinessSummary[FromDate]),'vwBusinessSummary'[FromDate])

PYMTD DAYS OPEN = CALCULATE([MTD Days Open],DATEADD(DATESMTD(AllDates[TheDate]),-1,YEAR))

 

 

attached is a screen shot of my data, as you can see the MTD is summing but the PYMTD is not.  Any suggestions?

 

 

1.PNG 

 

13 REPLIES 13
Greg_Deckler
Super User
Super User

Without seeing your data, or a sample of it, and replicating the issue, my guess would be that something is making the measure formula essentially invalid in the "ALL" context, which is essentially what the total line represents.



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...

See attached for the data.  

 

Additional Information, this is the dates open for our stores, Monday through Saturday (no Sunday), I am wondering if not having continuous days an issue, though it works for the MTD.

 

FromDate

Sean
Community Champion
Community Champion

@gator99

How are the 2 tables related?

 

What do you get with this formula?

PYMTD DAYS OPEN =
CALCULATE (
    COUNT ( vwBusinessSummary[FromDate] ),
    DATEADD ( DATESMTD ( AllDates[TheDate] ), -1, YEAR )
)

DATEADD does require a contiguous date column - but it seems you already have a date table (AllDates)

 

You can also try

PYMTD DAYS OPEN 2 =
CALCULATE (
    COUNT ( vwBusinessSummary[FromDate] ),
    SAMEPERIODLASTYEAR ( AllDates[TheDate] )
)

 

First Formula gives me same results but no sum for the column, second give me the error rearding contiguous dates.

 

Relationship (see attached).

 

thanks for all your assistance.

 

relationship.PNG

Hi @gator99,

Please use the date table in both formulas, and check if it works.

MTD Days Open = TOTALMTD(COUNT(vwBusinessSummary[FromDate]),AllDates[TheDate])
PYMTD DAYS OPEN = CALCULATE([MTD Days Open],DATEADD(DATESMTD(AllDates[TheDate]),-1,YEAR))

 

If you have other issues, please let me know.

Best Regards,
Angelia

When I changed the MTD Days Open to what you suggested I loose the summation on the MTD Days Open colum as well.

Hi @gator99,

Do you have resolve your issue? If it does, I am very gald to hear you have resolve your issue, please mark the corresponding reply as answer if it's helpful, so other people will find solution easily. If it doesn't, please feel free to ask.

 

Best Regards,
Angelia

No it didn't resolve my issue.

Any other thoughts on my issue?

Hi @gator99,

 

While talking about this problem with @RobJo and @edejes2 we came to the conclusion that we won't be able to fully help you unless you can share the pbix file (obviously with dummy data) or dummy data itself in XLSX or CSV format for example.

 

The new official Microsoft Power BI User Group board has a nice place to share files, or if you prefer, you can upload to any other place of your choice.

 

 

We discussed this issue in the "Global Power BI - Forum Aid" event.

Come join us at the new pbiusergroup.com board for more info & help

 

 



Please mark my reply as the solution if it help you out.
Also check out www.globalpowerbi.com for info on Global Power BI, a Virtual User Group.

 

EDIT ***DELETED LAST POST****

 

So I think I have what you need, please find attached a zip file with the pbix and two excel files that builds my report.

 

data/pbix

 

 

Just thought I would reach out again to see if what I shared was accessible? Also to see if anyone had any suggestions.  Thanks again.

 

Sorry to bring this back up but I still have had no luck trying to figure out why one column sums and the other does not.  Any other thoughts?

 

Thank you so much for any help.

 

JBG

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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