Forum Discussion

Javierco's avatar
Javierco
Icon for Helper I rankHelper I
4 years ago
Solved

results in desktop differ from those published

my report connects to Azure Data Lake Gen 2 and combines several files from a different folders.

 

When I see results in desktop, everything looks just fine. But after publishing the report (did it twice) the results shown differ. 

 

I have tried to replace my division operator "/" by DIVIDE function with no success.

Also tried to reset sliders and refresh data with no success

 

 

published vs desktop

Please note that the diference is in the Sellout (USD)_v2 measure but not in the Sellout - Units column

 

Sellout (USD)_v2 DAX:

Sellout (USD)_v2 = SUMX( sellout_v2,DIVIDE((sellout_v2[amount]) , sellout_v2[Closest currency by date],0))

 

Closest currency by date:

Closest currency by date = 
var __player = sellout_v2[currency]
var __sprdate = sellout_v2[sales_date]
var __growth = 
    ADDCOLUMNS(
        FILTER(
            xrates,
            xrates[currency] = __player
        ),
        "diff", ABS((__sprdate - xrates[timestamp] ))
    )
var __mindiff = MINX( __growth,[diff])

var var_rate =     
    MAXX(
        FILTER( __growth, [diff]  = __mindiff ),
        xrates[rate]
    )

// https://community.powerbi.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/1860510
return
    var_rate

 

I do have also a date table:

Calendar = 

--Inputs--
VAR WeekStartsOn = "Mon"
VAR FiscalStartMonth = 7 

--NOTE: Calendar week starts from Monday

--Calculation--
RETURN
    ADDCOLUMNS (
        CALENDARAUTO ( FiscalStartMonth - 1 ),
        "MIndex", MONTH ( [Date] ),
        "FiscalMIndex", MONTH ( EDATE ( [Date], - FiscalStartMonth + 1 ) ),
        "CalMonth", FORMAT ( [Date], "mmm" ),
        "CalQtr", "Q"
            & CEILING ( MONTH ( [Date] ), FiscalStartMonth - 1 ) / ( FiscalStartMonth - 1 ),
        "CalYear", YEAR ( [Date] ),
        "Fiscal Week",
        
        VAR FiscalFirstDay =
            IF (
                MONTH ( [Date] ) < FiscalStartMonth,
                DATE ( YEAR ( [Date] ) - 1, FiscalStartMonth, 1 ),
                DATE ( YEAR ( [Date] ), FiscalStartMonth, 1 )
            )
        VAR FilteredTableCount =
            COUNTROWS (
                FILTER (
                    SELECTCOLUMNS ( GENERATESERIES ( FiscalFirstDay, [Date] ), "Dates", [Value] ),
                    FORMAT ( [Dates], "ddd" ) = WeekStartsOn
                )
            )
        VAR WeekNos =
            IF (
                FORMAT ( FiscalFirstDay, "ddd" ) <> WeekStartsOn,
                FilteredTableCount + 1,
                FilteredTableCount
            )
        RETURN
            "Week " & WeekNos,
        "Fiscal Qtr", "Q"
            & CEILING ( MONTH ( EDATE ( [Date], - FiscalStartMonth + 1 ) ), 3 ) / 3,
        "Fiscal Year",
        VAR CY =
            RIGHT ( YEAR ( [Date] ), 2 )
        VAR NY =
            RIGHT ( YEAR ( [Date] ) + 1, 2 )
        VAR PY =
            RIGHT ( YEAR ( [Date] ) - 1, 2 )
        VAR FinYear =
            IF ( MONTH ( [Date] ) > ( FiscalStartMonth - 1 ), CY & "-" & NY, PY & "-" & CY )
        RETURN
            FinYear,
        "MonthYear", CONCATENATE(YEAR ( [Date] ),CONCATENATE("-",FORMAT ( [Date], "mmm" ))),
        "YearMonthNum", VALUE(CONCATENATE(YEAR ( [Date] ),right(concatenate(0,MONTH ( EDATE ( [Date], - FiscalStartMonth + 1 ) )),2))),
        "CalWeekNo", WEEKNUM ( [Date], 2 ),
        "Weekend/Working", IF ( WEEKDAY ( [Date], 2 ) > 5, "Weekend", "Working" ),
        "Day", FORMAT ( [Date], "ddd" ),
        "CustomDate", FORMAT ( [Date], "d/mm" )
    )

 

Any help would be much appreciated

 

  • Javierco's avatar
    Javierco
    4 years ago

    Ok, I fixed it.

     

    I noticed that one column involved in the calculation was not being cast as a decimal number. Enforcing that and changing locale configuration to set the point as a the decimal separator solved it.

2 Replies

  • v-xiaotang's avatar
    v-xiaotang
    Icon for Community Support rankCommunity Support

    Hi Javierco 

    Preliminary guesses have these two possibilities. The information on the service is updated, or the data is filtered.

    Please try this measure, it will clear the filter on table sellout_v2,

    Sellout (USD)_v2 =
    SUMX (
        ALL(sellout_v2),
        DIVIDE ( ( sellout_v2[amount] ), sellout_v2[Closest currency by date], 0 )
    )

    Best Regards,

    Community Support Team _Tang

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

    • Javierco's avatar
      Javierco
      Icon for Helper I rankHelper I

      Ok, I fixed it.

       

      I noticed that one column involved in the calculation was not being cast as a decimal number. Enforcing that and changing locale configuration to set the point as a the decimal separator solved it.