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

Single slicer but multiple filters

Hi, 

 

I am new to PowerBI. Need some help on how to achieve the below result. 

I have my sales data which contains Order Date, Processed Date and Order Amount.  I have created 2 Calender tables and linked Order Date and Processed Date. 

 

Now I have want to create a single slicer with which I will be able to select the Year and Month and it filters the Order Data and Processed Date of that Year and Month and gives me the sales amount. 

 

Example Data:

Order DateProcessed DateSales Amount
1/01/20201/03/20205000
1/01/202013/01/20202000
1/01/202114/01/20213000
13/01/202114/01/20211000

 

Output:

If I select 2020 Jan -> 2000 (Filter on 2020 Jan Order Date and 2020 Jan on Processed Date) 

2021 Jan -> 4000

 

Please let me know how I can do this. 

 

Thanks in Advance.

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-yuaj-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your description, you can create a measure as follows.

Measure =

var x1=SELECTEDVALUE('calendar'[Date].[Year])

var x2=SELECTEDVALUE('calendar'[Date].[Month])

return

SUMX(FILTER(ALL('Sales'),[Order Date].[Year]=x1&&[Order Date].[Month]=x2&&[Processed Date].[Year]=x1&&[Processed Date].[Month]=x2),[Sales Amount])

 

Result:

0201case2.gif

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

6 REPLIES 6
v-yuaj-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your description, you can create a measure as follows.

Measure =

var x1=SELECTEDVALUE('calendar'[Date].[Year])

var x2=SELECTEDVALUE('calendar'[Date].[Month])

return

SUMX(FILTER(ALL('Sales'),[Order Date].[Year]=x1&&[Order Date].[Month]=x2&&[Processed Date].[Year]=x1&&[Processed Date].[Month]=x2),[Sales Amount])

 

Result:

0201case2.gif

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @Ashish_Mathur ,

 

Thank you for the file. 

Is there any way that I cannot alter the current table and convert coloumns into rows ( Attribute in your BI) . I have a lot of formulas written based on these coloumns. 

 

 

You are welcome.  I don't think so.  If we want a Year/Month slicer, we will have to keep only 1 date column in the base data sheet.

You may also want to wait for others to contribute to this thread.  May be others come up with a better solution.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @nandic 

Thank you for the video. I managed to use 1 calendar instead of two. 

 

Can you please help me on how to get the above result? I want to get the sales amount which is Ordered and Processed in the same month. 

 

Thanks in Advance.

 

 

 

nandic
Memorable Member
Memorable Member

Hi @Anonymous ,
Best practice is to have one Date table and then you can have multiple (1 active, multiple inactive) relationships.
After that you use DAX function USERELATIONSHIP to define which relationship to use.
Here is a nice video on this topic: https://www.youtube.com/watch?v=u8_aeLmXbVk 

Regards,
Nemanja Andic

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.