Forum Discussion
Suhel_Ansari
8 months agoHelper V
Wrong Total in Table
Hi all, I am getting worng total, I am tryint to calcualte the price of Power BI Licsenes cost for PPU, PRO and Free users using the following table and dynamically calculate the total which I am get...
- 8 months ago
Hi GeraldGEmerick - I got the answer using the ADDCOLUMNS however I have to use the multiple ADDCOLUMNS can you please help me to optimze this measure. Thanks
Royel
8 months agoSuper User
Hi Suhel_Ansari Since no sample file was shared, it’s difficult to write the exact DAX in one go. Please try the following and let me know how it goes.
License Cost =
VAR CurrentCount = COUNT('Table'[EmailID])
VAR Multiplier =
SWITCH(
SELECTEDVALUE('Table'[License]),
"PBI_PREMIUM_PER_USER", 22.50,
"Power BI Pro", 13.10,
"Free Users", 13.10,
BLANK()
)
VAR RowResult = CurrentCount * Multiplier
// For Total row - iterate and calculate each license type
VAR TotalResult =
SUMX(
VALUES('Table'[License]),
VAR LicCount = CALCULATE(COUNT('Table'[EmailID]))
VAR LicMultiplier =
SWITCH(
'Table'[License],
"PBI_PREMIUM_PER_USER", 22.50,
"Power BI Pro", 13.10,
"Free Users", 13.10,
0
)
RETURN LicCount * LicMultiplier
)
RETURN
IF(
ISINSCOPE('Table'[License]),
RowResult,
TotalResult
)
Thanks
Suhel_Ansari
8 months agoHelper V
- Royel8 months agoSuper User
Ahh, in this case we need some work around, are you able to share some sample file with expected results. so that we can test and come with proper calculations for measure.