Forum Discussion
Removing decimals from values while keeping for totals
- 1 year ago
Unfortunately, with live connection, you will need to apply the dynamic format string to the measure in the semantic model itself. Alternatively, you can create another measure that returns a formatted text instead
IF ( NOT ( HASONEVALUE ( Geo[Geo] ) ), FORMAT ( [my measure], "#,#.00" ), FORMAT ( [my measure], "#,#" ) )
Try a possible approach using a calculated column:
Create a Calculated Column:
Add a new calculated column to your 'Date' table:
IsTotal = IF(
HASONEVALUE('Date'[Week Start Date]),
FALSE,
TRUE
)
Modify Your Measure:
Modify your Dispatch average measure to incorporate the IsTotal column:
Dispatch average =
IF(
MAX('Date'[IsTotal]),
FORMAT(
AVERAGEX(
KEEPFILTERS(VALUES('Date'[Week Start Date])),
CALCULATE('Stock Movement'[Dispatch count])
),
"0"
),
AVERAGEX(
KEEPFILTERS(VALUES('Date'[Week Start Date])),
CALCULATE('Stock Movement'[Dispatch count])
)
)
This modified measure will format the total value as an integer and display the detail values with decimal places.
Alternative Approach Using a Second Measure:
Create a Second Measure:
Create a new measure to calculate the formatted total:
Formatted Total Dispatch =
FORMAT(
AVERAGEX(
KEEPFILTERS(VALUES('Date'[Week Start Date])),
CALCULATE('Stock Movement'[Dispatch count])
),
"0"
)
Use the Measures in Your Visual:
In your table or matrix visual, use the Dispatch average measure for the detail rows and the Formatted Total Dispatch measure for the total row.
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
saud968Unfortunatelly since company uses live connection method.
I am limited to only being able to create measures.
So I cant do any calculated columns.