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.
I am in the process of creating a report that is refreshed on a monthly basis, however, I have not been able to create a DAX formula that is sufficient for my needs and instead I have been manually updating the formula on a monthly basis which is certainly not ideal. FYI – I am self-taught and very new to Power BI.
I have a data pull that will return a list of clients and the products they purchased that incurred sales over $10k in a given month. Clients without a purchase, or those that did not exceed the $10k threshold for any given product, are excluded from the data file.
I have my measures set up within a matrix with two columns. The first column returns the unique number of products that exceeded the sales threshold in the most recent month. The second column returns the percentage of sales associated with the products over the $10k threshold as a percentage of the current months total sales. For example, over the course of the past month Client A purchased 5 different products with total sales of $100k. However, only 2 of those products total sales exceeded the $10k threshold, Product 1 was $45k and Product 2 was $40k. The other 3 products made up the final $15k in sales. The first column would then return “2” and the second column would return “85%.” The measures are working but I must manually update the date each month instead of this being dynamic.
My problem is that if I use Max Date, it will return values for the most recent month in which the client had sales eclipse the $10k threshold for a product instead of the most recent month. For example, if Client B last had a product purchase over $10k back in June 2021, the matrix will show that months data instead of excluding them entirely. I would like to exclude those client from the matrix that do not meet the metric for the most recent month.
Below is my current measure for distinct count of products. As you can see, the date is hard-coded.
Sales in current month over $10k = CALCULATE(SUM('Client Sales over $10k'[Product Distinct Count]),FILTER('Client Sales over $10k','Client Sales over $10k'[Paid YYYYMM]=(202110)))
Any suggestions are much appreciated!
Solved! Go to Solution.
Hi ,
If you just want to exclude others from the matrix, you can create a measure as a visual level filter:
Measure_filter =
var max_date = CALCULATE(MAX('Table'[Paid YYYYMM]),ALL('Table'))
return IF(max_date=MAX('Table'[Paid YYYYMM]),1,0)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi! Could you solved this? If you did, could you please share the answer? I have the same problem. The formula bring current values if it has, but, when it doesn't bring lastest avaliable month data. I had tried with DATESMTD, DATEADD, IF and even variables.
Hi ,
If you just want to exclude others from the matrix, you can create a measure as a visual level filter:
Measure_filter =
var max_date = CALCULATE(MAX('Table'[Paid YYYYMM]),ALL('Table'))
return IF(max_date=MAX('Table'[Paid YYYYMM]),1,0)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@reboundgt9 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Please let me know if this is helpful. Below is some made up sample data.
Data below shows 3 clients and sales by date, product ID, and Sales total. I would like to show only Client B as 2 since the most recent Paid YYYYMM is 202110. I would like to exclude Client A and Client C as they did not have sales in the most recent time period. Currently, I am only able to return Client B as expected if I manually input the date within the measure itself.
Client Name | Paid YYYYMM | Product ID | Sales Total |
Client A | 202107 | 000020138959 | 22,000. |
Client B | 202110 | 000015630228 | 15,000. |
Client B | 202110 | 000010523401 | 10,500. |
Client B | 202108 | 000014720392 | 50,000. |
Client B | 202107 | 000015918127 | 11,400. |
Client C | 202106 | 000020160984 | 19,700 |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |