Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Floriane
Contributor
Contributor

Conditional counting

Hello,

I am trying to calculate the difference between two year to show the results as a KPI (evolution throughout the year N and N-1).

This is what I tried to do, but it doesn't work and I can't really find out what's wrong with it since I am not really used to this language (I am way more used to Power BI which is working with DAX Language).

 

Here is what I wrote : 

SUM({<[sales_specialoffer.StartDate.autoCalendar.Year] *= {'2013'}>}count(SpecialOfferID])-
SUM({<[sales_specialoffer.StartDate.autoCalendar.Year] *= {'2012'}>}count(SpecialOfferID]))

Thanks for your replies !

Labels (3)
1 Reply
vinieme12
Champion III
Champion III

Try below

count({<[sales_specialoffer.StartDate.autoCalendar.Year] = {'2013'}>} SpecialOfferID]) - 

count({<[sales_specialoffer.StartDate.autoCalendar.Year] = {'2012'}>}SpecialOfferID])

 

Or

 

count({<[sales_specialoffer.StartDate.autoCalendar.Year] = {'2013'}>} DISTINCT SpecialOfferID]) - 

count({<[sales_specialoffer.StartDate.autoCalendar.Year] = {'2012'}>} DISTINCT SpecialOfferID])

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.