Please see the two statements below.
varSum = Totals.Sum (DataDataset, Dataset.InvServiceDt_IMonth == varMo ? Dataset.Charges :0);
varSum2 = Totals.Sum (DataDataset, Dataset.BA_Name == varBA ? Dataset.Charges :0);
varSum, varSum2, varMo, and varBA are variables (varBA is a string, the other three are integers or decimals). Each one of these statements works correctly separately. I need to apply both conditions to a single instance of the total, but I have not been able to figure out the correct structure to combine them. What do you recommend?
Thank you for for your assistance.
~ Judy H.
Total for value with both numeric and string conditions
Total for value with both numeric and string conditions
Judy Hennessey / PrecisionBI
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: Total for value with both numeric and string conditions
Hello,
Please send us a sample report with test data for analysis.
Thank you.
Please send us a sample report with test data for analysis.
Thank you.
Re: Total for value with both numeric and string conditions
I figured it out, thanks. I was trying to go with
varSum = Totals.Sum (DataDataset, Dataset.InvServiceDt_IMonth == varMo && DataDataset, Dataset.BA_Name == varBA ? Dataset.Charges :0);
I had the && concatenator figured out, but I also had to remove the second instance of the databand name.
varSum = Totals.Sum (DataDataset, Dataset.InvServiceDt_IMonth == varMo && Dataset.BA_Name == varBA ? Dataset.Charges :0);
varSum = Totals.Sum (DataDataset, Dataset.InvServiceDt_IMonth == varMo && DataDataset, Dataset.BA_Name == varBA ? Dataset.Charges :0);
I had the && concatenator figured out, but I also had to remove the second instance of the databand name.
varSum = Totals.Sum (DataDataset, Dataset.InvServiceDt_IMonth == varMo && Dataset.BA_Name == varBA ? Dataset.Charges :0);
Judy Hennessey / PrecisionBI
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: Total for value with both numeric and string conditions
Hello,
Thank you for the information.
Thank you for the information.