Forum Discussion

Nani's avatar
Nani
Frequent Visitor
2 years ago
Solved

Dax Issue (Total is not correctly populating in table visual after using a measure)

Hi ,

After adding the below measure((Adjusted revenue)  to the table visual The total is not showing correctly, as it taking the total of the measure(Revenue for selected range_without RMS forecasted revenue), which I used in adjusted revenue.
Note: I tried all the ways that I know, like using the SUMX function, etc. Stil is not able to crack this. Can someone please help me on this?

Adjusted Revenue =
VAR OriginalRevenue = [Revenue for selected range]    
VAR Adjustment =
    IF(
        SELECTEDVALUE(RevenueforStays[SystemName]) = "RMS" &&
        (
            (
                SELECTEDVALUE(RevenueforStays[ArrivalDate]) >= TODAY() &&
                SELECTEDVALUE(RevenueforStays[DepartureDate]) > TODAY()
            )
            ||
            (
                SELECTEDVALUE(RevenueforStays[ArrivalDate]) < TODAY() &&
                SELECTEDVALUE(RevenueforStays[DepartureDate]) > TODAY()
            )
        ),
        (SUM(RevenueforStays[RMSAVRG]) * [Paid Nights RFS]),
        0
    )
RETURN
    IF(Adjustment <> 0, Adjustment, OriginalRevenue)

Revenue for selected range =
VAR startdate =
MIN('Calendar'[Date])
VAR enddate =
MAX('Calendar'[Date])

RETURN
CALCULATE(
SUM('report vwRevenueDashboardReport_Revenueforstays'[Revenue]),
FILTER(
'report vwRevenueDashboardReport_Revenueforstays',
'report vwRevenueDashboardReport_Revenueforstays'[Staydate] >= startdate &&
'report vwRevenueDashboardReport_Revenueforstays'[Staydate] <= enddate
),
USERELATIONSHIP(
'report vwRevenueDashboardReport_Revenueforstays'[ReservationNumber],
RevenueforStays[ReservationNumber]
)
)

 

The total revenue for the selected range is 6765, but adjusted revenue should be 6,441.
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Nani ,

     

    You can create a new Adjusted Revenue measure to place on the visual object instead of the old one to see if the totals are correct.

    new Adjusted Revenue measure= SUMX(VALUES(Table[ArrivalDate]), [Adjusted Revenue Measure])

     

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Nani ,

     

    You can create a new Adjusted Revenue measure to place on the visual object instead of the old one to see if the totals are correct.

    new Adjusted Revenue measure= SUMX(VALUES(Table[ArrivalDate]), [Adjusted Revenue Measure])

     

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

    • Nani's avatar
      Nani
      Frequent Visitor

      Anonymous Thank you,Its working