Currency Agnostic Reporting

49 views
Skip to first unread message

simba masamba

unread,
Aug 10, 2026, 9:33:12 AMAug 10
to cgr...@googlegroups.com
Good day Team,

So I understand that CGRates is currency agnostic. However, I have a scenario where I have rateplans in 2 different currencies. I was able to report and calculate costs for one currency fine but however my reports are inaccurate when I created a rate plan with another currency as it is still feeding into the main / old report.
How do I :

1. Tag subs with a currency / any better way such that I can split costs and calculate accurately based on one currency and another?
2. Can I apply this tag to old /legacy subscribers so that I can refer to this tag in future.
3. How can I safely achieve this?

BR,

Simba

simba masamba

unread,
Aug 10, 2026, 9:33:18 AMAug 10
to cgr...@googlegroups.com, sup...@itsyscom.com
Good day Team,

Still struggling with this, I would appreciate any help I can get.
Thank you.

gezim....@itsyscom.com

unread,
Aug 10, 2026, 11:30:24 AMAug 10
to CGRateS
Hi Simba,

Before i suggest an approach, a few questions to understand your setup.

1. Is the currency setup  only per subscriber (each sub always billed in one currency), or can events for the same subscriber be rated in both currencies?

2. Does a "report" mean a CDR ?

3. What combination of Tenant, Category and Subject are you using in RatingProfile, since that is used to filter RatingPlans.

Also please provide us with some sample events along with your tariffplans.

Thanks,
Gezim.

simba masamba

unread,
Aug 12, 2026, 11:25:59 AMAug 12
to cgr...@googlegroups.com
hi Gezim,

I truly appreciate you taking the time to respond to my question - thanks.

I will answer your questions per point:
1. Subs are rated & billed in only 1 currency at any moment.
2. YES report means CDR - though I create the reports using a separate application but off the CDR entries and fields.
3. can you come again on this question

Below is a sample cgrates event for context: (please note I need approval first to send you any data )

   AccessInformation:
   Account: 263123456789
   AnswerTime: 0001-01-01T00:00:00Z
   CGRID: 8a9fab988754bd651e02982c857222b43515a446
   CallType:
   Category: call
   Cost: 0.0000
   Destination: 26389782314
   DestinationID: {}
   DestinationPrefix: {}
   IMSChargingId: 60559de306e08486e74c1d5595dda218
   OriginID: 0gQAAC8WAAACBAAALxYAALCBhcq57LZYKsjQmnuR/786PGVfR7UpKbI+0bxHNPTJ+JV87V4smPfBolFQJamoDzjm9zYaxMuoMgrRnuWUzyE-@IP-Address
   RatePlanID: {}
   ReleaseCode:
   RequestType: *prepaid
   RunID: *default
   SetupTime: 2026-08-12T09:35:40Z
   Subject: 263123456789
   TOR: *voice
   Tenant: lab.poc.test
   Usage: 0

Using the event above as an example, I want a way that I can see that this is an event in Pounds / Euros and I can craft reports in my external application nicely.

BR,

Simba



--
You received this message because you are subscribed to the Google Groups "CGRateS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cgrates+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cgrates/2a3554a2-1aa4-47cc-9e51-284cd2f640c5n%40googlegroups.com.

gezim....@itsyscom.com

unread,
Aug 17, 2026, 9:42:01 AMAug 17
to CGRateS
Hi Simba,

You can split this by using Category as a switch to pick the correct RatingPlan per currency .
CGRateS looks up which RatingPlan to use for a call via the key Tenant + Category + Subject in your RatingProfile.
So for each value of Category it can resolve to a different RatingPlan for the same account.

You can use example as below:
RatingProfiles.csv
#Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject
cgrates.org,call_usd,*any,2018-01-01T00:00:00Z,RP_USD,
cgrates.org,call_eur,*any,2018-01-14T00:00:00Z,RP_EUR,

Depending on how you generate your events, you can set Category value directly at creation or using Attributes to alter it.
Then in  CDRs you can use Category field (call_usd or call_eur) directly to filter based on currency for your reports.
If you are using balances  the Category filter can be used there as well to debit and keep record of balances for different currencies.
Feel free to ask if you have any further questions!

Thanks,
Gezim.

simba masamba

unread,
Aug 25, 2026, 3:32:13 PM (10 days ago) Aug 25
to cgr...@googlegroups.com
hi Gezim,

Thank you for your response - I appreciate it.

Can you expand on this please: " you can set Category value directly at creation or using Attributes to alter it "
Which one is the simpler / better approach and any links to documentation of how I can set this up?

In my events, the "category" field is set to simply "call", not confident how to alter this to e.g. "call_usd"

PS: I am not an expert in CGR - sorry for the many questions.

Regards,

Simba

Armir Veliaj

unread,
Aug 27, 2026, 4:38:23 AM (8 days ago) Aug 27
to CGRateS
Hi Simba,

As Gezim is on vacation, please check the answer below.

Setting the Category directly at creation depends on your switch and how you generate events, but you can alternatively use Attributes, as in this example:


#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,Path,Type,Value,Blocker,Weight
cgrates.org,ATTR_USD_ACCOUNTS,*sessions;*cdrs,*prefix:~*req.Account:263,,,,,,false,10
cgrates.org,ATTR_USD_ACCOUNTS,,,,,*req.Category,*constant,call_usd,,
cgrates.org,ATTR_EUR_ACCOUNTS,*sessions;*cdrs,*prefix:~*req.Account:44,,,,,,false,10
cgrates.org,ATTR_EUR_ACCOUNTS,,,,,*req.Category,*constant,call_eur,,


So, based on the account, the Category gets altered by AttributeS from call to call_usd or call_eur.

You need to make sure that you have the AttributeS connections configured in the SessionS section of the config file, including the index fields in the AttributeS configuration.

For the docs, you can check this link:
https://cgrates.readthedocs.io/en/latest/index.html

The most relevant sections for your case are:
Attributes: https://cgrates.readthedocs.io/en/latest/attributes.html#id2
Rating Profiles: https://cgrates.readthedocs.io/en/latest/rals.html#ratingprofile

Hope it helps.

Thanks,
Armir
Reply all
Reply to author
Forward
0 new messages