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
PBI5851
Helper V
Helper V

Calculating a sum but have specific filters for other measures

Hello,

I have the below two source tables

DocDetail

BeginFlagDoCUsageCountValueDateDocName
Yes20NULL6/3/2019Steve
No2NULL6/4/2019Steve
No1026/5/2019Steve
Yes25NULL7/6/2019Mark
No67NULL7/7/2019Mark
No4527/8/2019Mark
No34NULL7/9/2019Mark
No76NULL7/10/2019Steve
No77NULL7/11/2019Mark
Yes88NULL8/12/2019John
No918/13/2019John
No4NULL8/14/2019John
No34NULL8/15/2019John
No3428/16/2019John
No67NULL8/17/2019John
Yes66NULL9/18/2019Mary
No4419/19/2019Mary
No88NULL9/20/2019Mary
No5719/21/2019Mary
No35NULL9/22/2019Mary
No3529/23/2019Mary
Yes2359/24/2019John
No45NULL9/25/2019Mary

 

The ValueDate is linked to the Date table as..

YearMonthDatevalue
2019066/3/2019
2019066/4/2019
2019066/5/2019
2019077/6/2019
2019077/7/2019
2019077/8/2019
2019077/9/2019
2019077/10/2019
2019077/11/2019
2019088/12/2019
2019088/13/2019
2019088/14/2019
2019088/15/2019
2019088/16/2019
2019088/17/2019
2019099/18/2019
2019099/19/2019
2019099/20/2019
2019099/21/2019
2019099/22/2019
2019099/23/2019
2019099/24/2019
2019099/25/2019

 

The Goal is to end with 

YearMonthNetUsageCountDocValueDocName
201906220Steve
201907225Mark
201908388John
201909466Mary
201909523John

 

I am to capture the DocValue where the BeginFlag = yes for that Doc , but the Netusage count must be the sum for that month again for that Doc. I tried using All except as below 

NetUsageCount = Calculate(sum(Docdetail[UsageCount]), allexcept(DateTable, DateTable[YearMonth]), AllExcept(Docdetail[Docname]))

But the Usage count is getting 16 for everybody. Please advise on how to fix this. 

3 REPLIES 3
PBI5851
Helper V
Helper V

Thank you @CNENFRNL happy Camper was I , as your solution worked , until the specifications got changed and it now does work because of attached file and now it doesnt work.  https://file.re/2021/06/17/book2/ 

 

The differences are, DocID Count, is the count of DocId's that have a begin flag = yes, but the UsageSum, is the sum of UsageCount field for only those DocID's that have a Yes. So even though A9021 has a value of 6, it should not be counted, because it does have a yes Flag. Likewise, D2025 is counted/summed for 2/1 and 2/2 because it had a Yes for 2/1. 

 

Any help please. 

 

CNENFRNL
Community Champion
Community Champion

Screenshot 2021-06-16 161938.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

@CNENFRNL . Please look at the file at this link. When using your code, it is not working as the requirements were modified as per below. 

The differences are, DocID Count, is the count of DocId's that have a begin flag = yes, but the UsageSum, is the sum of UsageCount field for only those DocID's that have a Yes. So even though A9021 has a value of 6, it should not be counted, because it does have a yes Flag. Likewise, D2025 is counted/summed for 2/1 and 2/2 because it had a Yes for 2/1. 

 

Would you be able to provide a recommeded solution for this.  https://file.re/2021/06/18/book2/ 

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.