Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hello All,
I need to create a measure to use as a filter to dynamically show data only when the sum of the amount is not zero for a group. For an selected date range, If the sum of the amount is zero for an group, then do not want to show the group in the report.
I’ve the data as shown below. Have Group 1, Group 2 and Group 3. I need to show only the groups when the sum of amount is not zero for the selected range.
Input Data
Date | Group | Amount |
12/15/2023 | Group1 | 150 |
12/16/2023 | Group1 | -150 |
12/15/2023 | Group2 | 50 |
12/16/2023 | Group2 | 80 |
12/17/2023 | Group2 | -130 |
12/15/2023 | Group3 | 60 |
12/15/2023 | Group4 | 50 |
12/16/2023 | Group4 | -40 |
Expected Output in the report.
Case 1
When Date Selected <=12/15/2023, I would like to see the below result in the report.
Date | Group | Amount |
12/15/2023 | Group1 | 150 |
12/15/2023 | Group2 | 50 |
12/15/2023 | Group3 | 60 |
12/15/2023 | Group4 | 50 |
Case 2
When Date Selected <=12/16/2023, Result will have the data for Group 2, Group 3 , Group 4 for 12/15/2023 and 12/16/2023. Sum of the amount for Group 1 on 12/15/2023 and 12/16/2023 is zero, need to filter out in the report.
Date | Group | Amount |
12/15/2023 | Group2 | 50 |
12/16/2023 | Group2 | 80 |
12/15/2023 | Group3 | 60 |
12/15/2023 | Group4 | 50 |
12/16/2023 | Group4 | -40 |
I really appreciate any suggestion on meeting this requirement.
Solved! Go to Solution.
Thanks for your response.
This mesures works, but when i apply the date filter showing wrong values. I've updated the measure as shown below and getting the result as expected.
Hi,
Just write this meaure and filter with the condtiion >0
Measure =- sum(Data[Amount])
Thanks for the response.
I've to use this measure in a table visual as shown below. It has the Group Name and Date. Group 1 (150 + -150) and Group 2(-50 + -50 + 80) have the net amount is zero and should not listed in the table visual. When i use the Measure =- sum(Data[Amount]), Group 1 and Group 2 are showing in the visual.
I would appreciate for any recommendations.
Thank you!
Hi,
Assuming the Date field in the slicer and table visual has been dragged from the Calendar Table, write this measure
Measure = calculate(sum(Data[Amount]),all(calendar[date]))
Ths should now show 0 in the first 5 rows of the table visual. Filter this meaure with the criteria of <>0
Hope this helps.
Thanks for your response.
This mesures works, but when i apply the date filter showing wrong values. I've updated the measure as shown below and getting the result as expected.
@manojsubram Hi
Create measure as per below and use it as filter in filter panel as per below snap.
Zero1 =
var grp =
MAX('Table'[Group])
var zero =
CALCULATE(SUM('Table'[Amount]),
'Table'[Group] = grp ,ALLSELECTED('Table'[Date]))
return
zero
@ddpl - Thanks for your response.
1. This measure is working fine for a small set of data. I've a large dataset of 12 million and getting an error "Visual exceeding the available resourses. Please let know if you've any recommendation.
2. When we try to normalize the data model as shown below and update the measure to use the dimension. This is not giving the expected result.
Hi,@manojsubram
First, as I understand it, your requirement is that if the data is within the time interval of your desired data and the sum of the data within the group is zero, it is not displayed, otherwise it is displayed. If my understanding is wrong, please give me your relative opinion:
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2.I then created a slicer based on your time data that allows you to easily select a time interval:
3.I then created the following measure for filtering whether the data in the group sums to 0 or not:
Measure =
var zero1=CALCULATE(SUM(zero[Amount]),FILTER(ALLSELECTED(zero),'zero'[Group]=MAX('zero'[Group])))
return if(zero1=0,1,0)
4.Here's my final result, which I hope meets your requirements.
Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your response.
1. This measure is working fine for a small set of data. I've a large dataset of 12 million and getting an error "Visual exceeding the available resourses. Please let know if you've any recommendation.
2. When we try to normalize the data model as shown below and update the measure to use the dimension. Measure is throwing up error.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
93 | |
87 | |
80 | |
69 | |
68 |
User | Count |
---|---|
226 | |
129 | |
119 | |
83 | |
77 |