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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Isolate Items that are purchased in every month

Hello,

 

I have purchasing data that is added to every month with a monthly time stamp added. In January, all I have is Jan data. In February, I stack Feb under the Jan data, and so forth. I would like to figure out a way that isolates items that are purchased every month. My initial though would be to do a measure that counts each item, and then I can filter to the number of times it shows up (in August, filter to 8). How would this be written in DAX? Is there a better way to do it?

 

Thanks!

1 ACCEPTED SOLUTION

@Anonymous

 

Try the following steps

 

1. Create a measure called NumberofMonthsLapsed

    NumberofMonthsLapsed =  Month(MAx([MonthYear])) - Month(MIn([MonthYear])) + 1 

    This will generate the number of months between the first date and lastdate in the Sheet1 table.

 

2. Create a summary table  using

    SumCount = SUMMARIZE ( Sheet1,Sheet1[Item],"CountProd",Countrows(Sheet1))

 

3. Create a column in the SumCount table ShowYes as

   ShowYes = If([CountProd]=[NumberofMonthsLapsed],1,0)

  

   If the CountProd against each item is same as the NumberofMonthsLapsed set ShowYes as 1 else set it as 0.

 

4. Create a Table Report with fields from SumCount Table-  Item, CountProd

5. In the VisualFilter Drag the column ShowYes  and set Show items when the value is 1

6. The output will be 

    GroupNameSlicer.GIF

 

If this solves your issue, please accept it as solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

Can you provide sample data?

 

It sounds like you could create a custom column like:

 

MONTH([Date])

Then you could just do a count aggregation or a measure that uses COUNT or COUNTROWS along with that custom column in the axis.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I am a tad confused how I would go about a count aggregation  or a measure using COUNT or COUNTROWS. I'm fairly green with DAX and Power BI, so please bear with me. I have a link to sample data below. Note that items A, C, & D are bought every month, while B & D are not. My goal would be to easily filter out A, C, & D in a report page.

 

Dropbox

@Anonymous

 

Try the following steps

 

1. Create a measure called NumberofMonthsLapsed

    NumberofMonthsLapsed =  Month(MAx([MonthYear])) - Month(MIn([MonthYear])) + 1 

    This will generate the number of months between the first date and lastdate in the Sheet1 table.

 

2. Create a summary table  using

    SumCount = SUMMARIZE ( Sheet1,Sheet1[Item],"CountProd",Countrows(Sheet1))

 

3. Create a column in the SumCount table ShowYes as

   ShowYes = If([CountProd]=[NumberofMonthsLapsed],1,0)

  

   If the CountProd against each item is same as the NumberofMonthsLapsed set ShowYes as 1 else set it as 0.

 

4. Create a Table Report with fields from SumCount Table-  Item, CountProd

5. In the VisualFilter Drag the column ShowYes  and set Show items when the value is 1

6. The output will be 

    GroupNameSlicer.GIF

 

If this solves your issue, please accept it as solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Anonymous
Not applicable

That works perfectly. Thank you @CheenuSing

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors