Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

GP CM

How do I calculate GP for just the current month?

i tried =Sum(If(Month=(Today()),GrossProfit))

but ts not working.

Any ideas?

Thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

So both values display as "Jul". In that case it sounds like a simple date mismatch issue.

I assume your month field is a string saying "Jul" instead of an actual date value, while month(Today()) returns "Jul" but with an underlying numeric value, 7.

Take Miha's suggestion and add:

Sum( {<Month = {'$(=text(Month(Today())))'}>} GrossProfit)

Which should work fine with Jonathan's suggestion as well as you need to make sure the string values match up.

View solution in original post

14 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

If Month here is a field, then try this

=Sum(If(Month=Month(Today()),GrossProfit))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

nope didnt wrk.any other ideas?

jonathandienst
Partner - Champion III
Partner - Champion III

Is Month a field in the model? If so, is it in a format that can be compared with what's returned from the Month() function?

I usually avoid field names like Day, Month, Year as they are too easily confused with the built in functions.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Its a field yes, and the Month() functon doesnt work tho

Anonymous
Not applicable
Author

Hi Blaze,

I think you would make this a lot easier to answer if you uploaded an example document. That way everyone can see your date formatting and you should have a quick answer in your hands as there's a number of things that could cause the expression not to return a value.

Not applicable
Author

What about Set Analysis?

Sum( {<Month = {'$(=Month(Today()))'}>} GrossProfit)

Regards,

Miha

Not applicable
Author

I dnt think its possible guys. really sorry. If i enter Month(today()) then it returns the month.

Not applicable
Author

Hey Miha

Close, but its returning the total Gross Profit, not just for this month.

Not applicable
Author

is it possible, that you have different values in Month and Month(Today())?

Example: you have Month = jan, and Month(Today()) returns 1?