我维护了2张桌子,日期-仅包含日期和票证。通过使用票证中的CompletedDate到日期中的Date_1链接这些表。我编写了一个DAX度量,它将基于CompletedDate计算票证的运行总额。但是,对于没有售票的日期,它显示为空白。我想用最后一个非空白值填充空白。我尝试了https://community.powerbi.com/t5/Desktop/Filling-the-blanks-of-a-running-total-with-last-non-blank-value/td-p/169041此处提供的解决方案,但未对表进行任何更改。 TicketClosed_DateTbl 应该会让我达到预期的结果,但是值保持不变。
TicketClosed_Total =
CALCULATE(
[TotalTicket_Pending],
FILTER(
ALL('Ticket'[CompletedDate]),
'Ticket'[CompletedDate] <= MAX('Ticket'[CompletedDate])
)
)
TicketClosed_DateTbl =
CALCULATE(
[TicketClosed_Total],
USERELATIONSHIP('Date'[Date_1],'Ticket'[CompletedDate])
)
答案 0 :(得分:0)
基本上,您需要采取以下2项措施来计算累计票数和已售票数。我只是将每个月的第1个日期创建为CompletedDate以进行计算。
用于累积总票证
TimerDecibels = () => {
return this.state.sport.clubs.map((element) => {
// Set the date we're counting down to
var countDownDate = new Date(element.dateStopMatch).getTime();
// Update the count down every 1 second
var x = setInterval(function () {
// Get today's date and time
var now = new Date(element.dateMatch).getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor(
(distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60),
);
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById('demo').innerHTML =
days + 'd ' + hours + 'h ' + minutes + 'm ' + seconds + 's ';
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById('demo').innerHTML = 'EXPIRED';
}
}, 1000);
});
};
累计销售总额
cum_total_ticket =
CALCULATE(
SUM(Ticket[total ticket]),
FILTER(
ALL(Ticket),
Ticket[CompletedDate] <= MIN(Ticket[CompletedDate])
)
)
最终输出将是-