web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Count Expression in Visual Studio

(0) ShareShare
ReportReport
Posted on by 209

I have this Output with Expression (HIT AND MISS)

-------------------------------

Qty1           |      Qty2        |         HIT/MISS

10                         10                        HIT

15                         14                       MISS

20                         20                        HIT

23                         23                        HIT

----------------------------

HIT/MISS - has the Expression:

=Iif(Qty1.Value = Qty2.Value, "HIT", "MISS")

*now I need to COUNT the number of HIT and the Number of Items

output should be:

-------------------------------

Qty1           |      Qty2        |         HIT/MISS

10                         10                        HIT

15                         14                       MISS

20                         20                        HIT

23                         23                        HIT

                                                     HIT: 3 / 4

----------------------------

3 hits in 4 items.

the hard part of this is that the Values are Group, meaning the 4 Values of Qty1 and Qty2 are just SUM of the Group Item.

 


please help me achieve this output. thanks.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Hariharans87 Profile Picture
    3 on at

    You can try count/sum function with IIF condition

    For example:

    =CStr(Count(IIF(Qty1.Value = Qty2.Value, 1,Nothing))) &  "/" & CStr(Count(Qty2.Value))

    or

    =CStr(Sum(IIF(Qty1.Value = Qty2.Value, 1,Nothing))) &  "/" & CStr(Count(Qty2.Value))

  • XSpy Profile Picture
    209 on at

    Thanks for the reply Hariharan. but there's one problem that i encountered

    when i used your code:

    =CStr(Sum(IIF(Qty1.Value = Qty2.Value, 1,Nothing))) &  "/" & CStr(Count(Qty2.Value))

    the output shown counts all the Qty of the Qty1/Qty2 (i think because the items are grouped)

    output:

    HIT: 60 / 75

    it should be:

    HIT: 3/4

    how can i count the Grouped Data? thanks.

  • XSpy Profile Picture
    209 on at

    any solution for this Thread?

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    A/B

    for A write expression as following

    =Count(IIF(Fields!Qty1.Value = Fields!Qty2.Value, 1,Nothing),"YourDataSetName")

    if its not giving you correct result try with DataGroupName

    =Count(IIF(Fields!Qty1.Value = Fields!Qty2.Value, 1,Nothing),"NameOfGroup")

    for B try following expression

    =CountRows("GoupName")

    or

    =CountRows("DatSetName")

  • Hariharans87 Profile Picture
    3 on at

    If that are having group then, you can mention the group name in the sum function

    =CStr(Sum(IIF(Qty1.Value = Qty2.Value, 1,Nothing), "group_1")) &  "/" & CStr(Count(Qty2.Value), "group_1")

    Sum(ReportItems!FinalCost.Value, "group_1")

  • Hariharans87 Profile Picture
    3 on at

    Please try this expression

    =CStr(IIF(Sum(Qty1.Value, "group_1") = Sum(Qty2.Value, "group_1"), 1, Nothing)) &  "/" & CStr(Count(GroupedField.value, "group_1"))

  • XSpy Profile Picture
    209 on at

    thanks for the replies.

    still can't get the desired results, what to do...

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at
    • try to identify problem and describe it well
    • wait for a more better reply
    • post it on SSRS forum, you can get a more better and valid answer
  • XSpy Profile Picture
    209 on at

    any new suggestions for the Question? thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans