Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Thanks for viewing. What I thought would be simple has me stumped.
PBI File: PBI Deliveries File
I have a simple task - find out what stores were NOT delivered depending on the user's Week Ending choice. It seems to work choosing 1 week, but when I choose multiple weeks, using the slicer, the number should decrease and not increase.
The delivered column contains a whole number of how many deliveries per week were made (0-3). I need to focus solely on those stores that didn't have a delivery over the weeks - stores that 'delivered' data adds up to 0.
3 Columns of Data
The "visual" filter I have in place to show only those stores not delivered:
When I choose 1 week, it works fine. The total is 208 in this example:
count_not_delivered =
CALCULATE(
COUNTA(deliver_data[store_num]),
FILTER('deliver_data', 'deliver_data'[delivered] = 0)
)
When I choose all 3 dates, it should only be 13, but instead, it adds up to 643.
I understand why - it's counting all stores with a 0 in the 'delivered' column for all 3 weeks individually. I need it to somehow SUM all 3 weeks and filter by that and I'm not finding anything online to help.
I feel like this should work, but of course, it doesn't.
count_not_delivered =
CALCULATE(
COUNTA(deliver_data[store_num]),
FILTER('deliver_data', SUM('deliver_data'[delivered]) = 0)
)
Any help would be appreciated!
Solved! Go to Solution.
This will do it @Darrell
New Measure =
COUNTX(
FILTER(
ADDCOLUMNS(
SUMMARIZE(
'deliver_data',
'deliver_data'[store_num]
),
"@Total",
CALCULATE(
SUM( 'deliver_data'[delivered] )
)
),
[@Total] = 0
),
'deliver_data'[store_num]
)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThis will do it @Darrell
New Measure =
COUNTX(
FILTER(
ADDCOLUMNS(
SUMMARIZE(
'deliver_data',
'deliver_data'[store_num]
),
"@Total",
CALCULATE(
SUM( 'deliver_data'[delivered] )
)
),
[@Total] = 0
),
'deliver_data'[store_num]
)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThanks! I'll take some time and work through your solution. I appreciate it!
Glad to help @Darrell - what ADDCOLUMNS(SUMMARIZE()) is doing is building a mini-table that is grouped the way you were describing the desired results, the it FILTER()'s it, then COUNTX will count the instances. Any questions, let me know.
I used DAX Studio to build the mini-table so I could see what it was. Here is how the table looks with no filtering by a slicer. Once in Power BI and a slicer affects it, it changes.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingIf you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 23 | |
| 14 | |
| 10 | |
| 6 | |
| 5 |