<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: month range combines with time range in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2887483#M93645</link>
    <description>&lt;P&gt;Worked right away! Thanks alot!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 06 Nov 2022 12:24:11 GMT</pubDate>
    <dc:creator>kent_n</dc:creator>
    <dc:date>2022-11-06T12:24:11Z</dc:date>
    <item>
      <title>month range combines with time range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2886986#M93611</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im an absolute novice and tried google with no luck.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Completely failed my first try to explain my issue (thanx &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="349489" data-lia-user-login="daXtreme" class="lia-mention lia-mention-user"&gt;daXtreme&lt;/a&gt;&amp;nbsp;:), hopefully this might explain what I want to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following measure is working just fine, but only between april 1st and october 31st.&amp;nbsp;&lt;/P&gt;&lt;P&gt;From november 1st to march 31st the filtered value&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;EM&gt;fixed_prices[Pristabell]="Profit_low"&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;should instead be&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;EM&gt;fixed_prices[Pristabell]="Profit_high"&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;for all the hours between 06-22 (06AM-10PM)&lt;/DIV&gt;&lt;DIV&gt;Hours between 22-06 (10PM-06AM) are always "Profit_low" year around.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Subvention &amp;amp; Grid Compensation = 
(CALCULATE(
    SUMX(FILTER(
        fixed_prices,fixed_prices[Pristabell]="Elsubvention"||fixed_prices[Pristabell]="Profit_low"),fixed_prices[öre/KwH (ink moms)])) / 100)
        * SUM(Energy_sales_price[Production])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Energy_sales_price&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;fixed_prices&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;hour_table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;date_table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 14:42:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2886986#M93611</guid>
      <dc:creator>kent_n</dc:creator>
      <dc:date>2022-11-05T14:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: month range combines with time range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2886988#M93612</link>
      <description>&lt;P&gt;Completely unclear. Please get familiar with this first:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-Get-Your-Question-Answered-Quickly/td-p/1626726" target="_blank"&gt;How to Get Your Question Answered Quickly - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 12:44:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2886988#M93612</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-11-05T12:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: month range combines with time range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2887212#M93622</link>
      <description>&lt;LI-CODE lang="csharp"&gt;Subvention &amp;amp; Grid Compensation =
// To get what you want you have to
// iterate over Date and Timme and
// take action accordingly.
// The dimensions should be connected
// by 1-&amp;gt;&amp;gt;-* to the fact table. fixed_prices
// is a stand-alone table without any connections.
//
// Then you can write something like:
var SwitchMonthNumbers = 
    {
        1,  -- jan
        2,  -- feb
        3,  -- mar
        11, -- nov
        12  -- dec
    }
var Output = 
    sumx(
        summarize(
            Energy_sales_price,
            date_table[Date],
            // Make sure you've got MonthNumbers
            // in date_table.
            date_table[MonthNumber],
            hour_table[Timme],
            hour_table[High_low_hour]
        ),
        var CurrentMonthNumber = date_table[MonthNumber]
        var TotalProduction = 
            calculate( 
                SUM( Energy_sales_price[Production] ) 
            )
        var HighLowProfit = 
            if( hour_table[High_low_hour] = "High",
                "Profit_high",
                "Profit_low"
            )
        var FixedPriceTableFilter =
            {
                "Elsubvention",
                if(
                    CurrentMonthNumber in SwitchMonthNumbers,
                    HighLowProfit,
                    "Profit_low"
                )
            }
        var FixedPrice =
            SUMX(
                FILTER(
                    fixed_prices,
                    fixed_prices[Pristabell] in FixedPriceTableFilter
                ),
                fixed_prices[öre/KwH (ink moms)]
            )
            * TotalProduction / 100
        return
            FixedPrice
    )
return
    Output&lt;/LI-CODE&gt;
&lt;P&gt;Something like this. I did not do any optimization on this. Wrote it without any real data and model. Might work... might not. Try to adjust it to your model.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 19:16:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2887212#M93622</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-11-05T19:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: month range combines with time range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2887483#M93645</link>
      <description>&lt;P&gt;Worked right away! Thanks alot!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 12:24:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2887483#M93645</guid>
      <dc:creator>kent_n</dc:creator>
      <dc:date>2022-11-06T12:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: month range combines with time range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2887521#M93651</link>
      <description>&lt;P&gt;Sorry, eent through the whole year and double checked some vaulues.&lt;/P&gt;&lt;P&gt;I forgot that the conditions only apply to monday-friday! Saturday and sundays are always Low.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I´ve added a Column in my date_table named Day of week with monday = 0 and sunday = 6&lt;BR /&gt;&lt;BR /&gt;I can´t figure out how to add this &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 13:15:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/month-range-combines-with-time-range/m-p/2887521#M93651</guid>
      <dc:creator>kent_n</dc:creator>
      <dc:date>2022-11-06T13:15:13Z</dc:date>
    </item>
  </channel>
</rss>

