cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
taisiya
Helper II
Helper II

Calculate count of IDs per month, ignoring number of days selected in slicer

Hello,

 

I need ninjas' help here. 

 

I try to calculate previous month amount in such a way, that later on I can put it as a KPI in a card visual. It should always show previous month amount relatively to what is seleceted in the date slicer. I tried PARALLELPERIOD(), but honestly I don't fully get how it functions as it was not showing me the right numbers. I also tried the syntaxis with Selected_Month = MAX(Selected_Month - 1), but I didn't succeed as I get just blank card.

 

Now I am using this expression:

 

Previous_Amount = CALCULATE([Count of IDs],PREVIOUSMONTH('Datetable'Date.[Date]),ALLEXCEPT('Date','Date'Date.[Month]))
 
The restriction is that Datetable contains duplicates as I work with time series data.
 
The best what I achieved by now is getting a table which returns me previous months amounts, but 1) it shows it thoughout the year, regardless month selected in the slicer; 2) I cannot convert this into a card.
 
I hope some help will come 🙂 Thank you in advance!
1 ACCEPTED SOLUTION

Hi @taisiya 

Got it, if you have resolved the issue, please mark the reply as answer to close this thread.

Regards,

 

Community Support Team _ Cherie Chen
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

5 REPLIES 5
v-cherch-msft
Microsoft
Microsoft

Hi @taisiya 

 

You may create a measure like below.If it is not your case,please share some data sample and expected output. You can upload the .pbix file to OneDrive and post the link here. Do mask sensitive data before uploading.

Measure =
CALCULATE (
    COUNT ( Data[Products] ),
    FILTER (
        ALL ( Slicer ),
        Slicer[Index]
            >= SELECTEDVALUE ( Slicer[Index] ) - 1
            && Slicer[Index] < SELECTEDVALUE ( Slicer[Index] )
    )
)

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

That is also not my case cause it will throw me an error about 'multiple values were supplied', I tried that as well. However I managed to solve the issue. If anyone is interested, I can post sample query here. 

 

And thanks once again.

Hi @taisiya 

Sample data and expected output will be helpful to provide an accurate solution.

Regards,

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

 

I've managed to solve the problem. Thanks for cooperation.

 

Kind regards,

Taisiya

Hi @taisiya 

Got it, if you have resolved the issue, please mark the reply as answer to close this thread.

Regards,

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

Power BI Dev Camp Session 22 with aka link 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!