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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
AmiraBedh
Resident Rockstar
Resident Rockstar

Get the count of products with date_sold between the current selection until the last year

I have two slicers :

  • month
  • year

I want to calculate the total of product with the date_sold between the year selected and the month selected

and the last year the same month.

Example :

Current selection : 

month : january

year : 2022

the range : january 2021 - january 2022

 

The measure of count is simple : CountProducts = COUNT(FCT_Table[ProductID]) 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
1 ACCEPTED SOLUTION
amirabedhiafi
Impactful Individual
Impactful Individual

YourMeasure=
CALCULATE(COUNT(FCT_Table[ProductID])
DATESINPERIOD(FCT_Table[date_sold],
LASTDATE(FCT_Table[date_sold]),-12, MONTH),
USERELATIONSHIP(dim_calendrier[id],FCT_Table[date_sold]))

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

View solution in original post

1 REPLY 1
amirabedhiafi
Impactful Individual
Impactful Individual

YourMeasure=
CALCULATE(COUNT(FCT_Table[ProductID])
DATESINPERIOD(FCT_Table[date_sold],
LASTDATE(FCT_Table[date_sold]),-12, MONTH),
USERELATIONSHIP(dim_calendrier[id],FCT_Table[date_sold]))

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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