conversion
6 TopicsNeed help changing currency
Hi! I need help converting my sales values between 3 difference currencies. I have 2 slicers in my dashboard, one to select the country that my store is in, and the other to select the currency that I want to view my sales figures in. I want to switch between SGD, MYR and USD. I have the conversion rate in the table below. My sales figures are reported in their base currency (Singapore Sales in SGD while Malaysia Sales in MYR). Scenarios Scenario 1: Country selected = Singapore Currency selected = SGD/MYR/USD return total sales in SGD/MYR/USD Scenario 2: Country selected = Malaysia Currency selected = SGD/MYR/USD return total sales in SGD/MYR/USD I have been experimenting with SWITCH() based on SELECTEDVALUE() of my currency slicer but I did not get it to work for all the conversions. Could anyone point me in the right direction? Thanks! Example Converting total Singapore sales from SGD to USD: 100 + 200 = SGD$300 SGD$300 / 1.349 = USD$222.39 Sample Data Currency Conversion Lookup: Conversion Rate Country Base Currency Converted Currency Conversion (notes) 1.349 Singapore SGD USD SGD to USD 4.578 Malaysia MYR USD MYR to USD Sales Table: Country Sales Singapore 100 Singapore 200 Malaysia 300 Malaysia 600Solved2.1KViews0likes1CommentConverting Excel Workbook to Power BI DAX
Hi, I have several big formulas sitting in an existing Excel workbook that I need to transfer over to Power BI, however I have no idea how to convert these ones. Some are using the MATCH function from Excel, others I fear may be too long. If someone can provide some advice on how to make these work in DAX, that would be appreciated. I have more, but I think if I can understand how to acheive the below, it will help with the others. Month of Invoice This one looks at the following new fields in Power BI 'Invoice Number' in TEXT format 'Month' in TEXT format =IFERROR(IF([@[Invoice Number]]<>"",TEXT(INDEX(tbl_InvoiceNumbers[Month],MATCH([@[Invoice Number]],tbl_InvoiceNumbers[Invoice Number],0),),"mmmm"),""),"") EDD I have put this into Power BI as it looked simple enough, however it did not work. 'Quoted EDD' is in DATE format. EDD = IF('Stock Orders'[Quoted EDD]="","",IF('Stock Orders'[Quoted EDD]=1,"",'Stock Orders'[Quoted EDD])) It receives error DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values. Date Ordered I have put this into Power BI as it looked simple enough, however it did not work either. 'Date Submitted' is in DATE format. Date Ordered = IF('Stock Orders'[Date Submitted]="",IF('Stock Orders'[PP]="PP1",DATE(2015,7,1),IF('Stock Orders'[PP]="PP2",DATE(2016,7,1),IF('Stock Orders'[PP]="PP3",DATE(2017,7,1),IF('Stock Orders'[PP]="PP4",DATE(2018,7,1),IF('Stock Orders'[PP]="PP5",DATE(2019,7,1),IF('Stock Orders'[PP]="PP6",DATE(2020,7,1),IF('Stock Orders'[PP]="PP7",DATE(2021,7,1),IF('Stock Orders'[PP]="PP8",DATE(2022,7,1),IF('Stock Orders'[PP]="PP9",DATE(2023,7,1),'Stock Orders'[Date Submitted]))))))))),'Stock Orders'[Date Submitted]) It receives error DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.Solved1.2KViews0likes3CommentsTrying to get a total with several requirements
I am trying to get a total of Agreement Hours but need to filter several requirements. Here is the SQL sum(case when Time_Entry.Agr_Header_RecID is not null and AGR_Hours = Hours_Bill and Billable_Flag = 'True' and Time_Entry.Company_RecID <> 250 then AGR_Hours else 0 end) AGR_Hours_Total and here is what I have tried to do in DAX Actual_AGR_Hours_total = Calculate(Sum(Switch(not(ISBLANK('Time Table'[AGR_Header_RecID])) & 'Time Table'[AGR_Hours] = 'Time Table'[Hours_Bill] & 'Time Table'[Billable_Flag] = True & 'Time Table'[company_RecID] <> 250, 'Time Table'[AGR_Hours] , 0))) The table names are different from the SQL and what I pulled into Power BI fyi. 'Time Table' is correct.Solved586Views0likes2CommentsPython to DAX Conversion
Hello, We are trying to convert the following python code into DAX. The goal is to distinct count of case number (caseno) grouped by (year), where occ date/time (occuron) is like YYYY Any help or assitance is greatly appreciated. Anything bolded is the column name in our dataset. Anything underlined denotes the table. The tables and columns would be indicated in DAX like: (e.g., 'table' and [column] would come from this: 'wa offense'[caseno] SELECT date_format(occuron, '%Y') AS occuronyear, count(DISTINCT caseno) AS dis_caseno FROM wa offense GROUP BY date_format(occuron, '%Y') ____________________ Specfic ibroff category: SELECT date_format(occuron, '%Y') AS occuronyear, count(DISTINCT caseno) AS dis_caseno, ibroff FROM wa offense GROUP BY date_format(occuron, '%Y'), ibroff Alternatively, is there a way to utilize python instead of DAX? Thank you!2.2KViews0likes1CommentConverting seconds to HH:MM:SS text format repeatedly
I have a DAX measure to convert my [Duration in sec] to hh:mm:ss text format. However, if I have several measures which I need to convert to hh:mm:ss text format, e.g. [call Duration in sec], [call Duration in sec wk], [email duration in sec], [email Duration in sec wk], is there a way that I will only create one DAX measure 'Time in Text' that formats them all? Time in Text = VAR Seconds = [Duration in sec] VAR Minutes = INT ( Seconds / 60 ) VAR RemSeconds = MOD ( Seconds, 60 ) VAR Hours = INT ( Minutes / 60 ) VAR RemMinutes = MOD ( Minutes, 60 ) RETURN Hours & ":" & RemMinutes & ":" & RemSeconds3.5KViews0likes1CommentFind the Forex Rate for the last day of the month for any transactions within that month
I am trying to create a measure that will find and use the Forex Rate from the last day of the month for any transaction within that month. I have the below measure which works for finding the Forex Rate that matches the transaction date for transactions that are related to Revenue and Cost of Sales (and accounts for gaps in Forex Rates over weekends). However, for internal General Ledger Journals, we need to use a general reporting Forex Rate, which we input into our system, with an end of month date (29, 30, or 31, etc.). How do I amend the below measure to find the Forex Report Rate at the end of each month for those General Ledger Journals with transaction dates within that month? Fx to USD Report = IF( SELECTEDVALUE( GLTrans[BaseCurr] ) = "USD", 1, MAXX( TOPN( 1, FILTER( ALL( ForexRates ), ForexRates[Base Currency] = SELECTEDVALUE( GLTrans[BaseCurr] ) && ForexRates[Forex Date] <= MAX( GLTrans[DateTrans] ) ), ForexRates[Forex Date], DESC ), ForexRates[Report Rate] ) )800Views0likes1Comment