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
deedeedudu
Helper II
Helper II

Get the % based on filter on one field but ignore the filter/slicer on date

Hi 

I have two tables coming from different sources but with similar column names and information as following

Table ABC

deedeedudu_0-1656563982827.png

 

Table EFG

deedeedudu_3-1656564708320.png

 

 

I have created a Calendar table and have created Columns to slice data as per custom data ranges:

deedeedudu_2-1656564133422.png

Sample: 

This Month =
IF (
DATEDIFF (
'Calendar'[Date],
TODAY(),
MONTH
) = 0,
"This Month",
"No"
)
 
These columns are used as a slicer for a table that displays summarized data for all the customers
 
Scenario:
I need to calculate Delivery Rate = (Delivered/ Sent)*100%
If i don't apply any filter on Customer Name and don't use any of the slicers for data ranges then the Delivery Rate would be
= (SUM(ABC[Delivered]) + SUM(EFG[Delivered])) / (SUM(ABC[Sent]) + SUM(EFG[Sent]))
 = 68.20%
 
Problem:
I want to create a measure that calculates Delivery Rate for 
a. This Month
b. Last Month
ignoring the slicers for static date ranges but considering the filter for customers.
 
Eg. 
If I have selected a filter for Customer Name= BB and irrespective of whatever i choose in the static date range slicers my new measures should give the following:
This Month = 50%
Last Month = 45%
1 REPLY 1
amitchandak
Super User
Super User

@deedeedudu , My suggest would field parameter with measure using date table and time intellignece

 

measures

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

 

 

new column

Month Rank = RANKX(all('Date'),'Date'[Month Start date],,ASC,Dense)

 

Measure
This Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])))
Last Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])-1))

 

 

With a separate date table, it should work for the customer

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

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.