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
Vvelarde
Community Champion
Community Champion

Create a Measure with calculate of a specified period with no affect by slicers

I have this data:

 

Table Sales

 

Year        Month        Sales  Product

2015     December     7500   Shoes

2015     December     8000   Pants

2016     January       10000   Shoes

2016     January       15000   Pants

2016     February      80000  Shoes

2016     February      80000  Pants

2016     March          7500   Pants

2016    March          5000    Shoes

 

Table Month

 

Month

January

February

December

 

Table   Losses

 

Year        Month        Losses  Product

2015     December     4500     Pants

2015     December     3500     Shoes

2015     January        2500     Shoes

2015     January        1500     Shoes

 

I need to create a measure that show me the selected month (In a slicer) with the Sum of sales in December 2015 and also another to show me the losses in this month selected.

 

My table desired is this

 

Product --Sales (Month Selected In Slicer) -- Sales(Always December 2015) --- Losses (Month Selected in Slicer)

Pants            Xxxxxx                                          8,000                                                     XXXXXXXXX

Shoes            xxxxxxx                                       7,500                                                       XXXXXXXX

 

 

When i slice by Month in Sales and select a Month by example March; Field Sales show corrects but Losses no.

 

When i slice by Table Month and select a Month by example March; Field Losses show corrects but Sales December is Blank.

 

My Dax Formula for measure in Sales December is

 

SalesDEC2015 = CALCULATE(Sum([Sales]);CALCULATETABLE( Sales[Month]="December";Sales[Year]=2015))

 

Thanks for your any help.

 

 

 

 

 

 




Lima - Peru
1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@Vvelarde You need to either combine Sales and Losses Columns in 1 Table

OR

you need a Product Table to make this work.

 

Then you can only drag Sales and Losses to a table and you'll get what you want - you don't need anything else except SUM

Calculate - 3 Tables.png

View solution in original post

1 REPLY 1
Sean
Community Champion
Community Champion

@Vvelarde You need to either combine Sales and Losses Columns in 1 Table

OR

you need a Product Table to make this work.

 

Then you can only drag Sales and Losses to a table and you'll get what you want - you don't need anything else except SUM

Calculate - 3 Tables.png

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.